How to use ARITHABORT in a view?

827 Views Asked by At

I've got a view which is working very fast in SSMS (MS Sql Server) but working really slow in my web app. My ARITHABORT setting in the database is set to ON but I'm unsure whether this continues through to the web app.

Is there any way to set this in the view itself? I know there are other possible issues in the speed discrepancy between the SSMS and the web app but just want to give this a go (as many other people with the same issue say this resolves it).

By the way, I'm not a database admin and don't really have access rights. All I have is this view and the code for the bit of the web app I'm working on.

1

There are 1 best solutions below

6
Dheebs On

Yeah definately mate.

Here is an example of one of the view from our data warehouse.

You can set anything you want in the top section

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE view [dbo].[vw_Dim_Date]
as

-- select * from dbo.vw_Dim_Date

SELECT [Date_key]
, Format([Full_date],'MMMMM yyyy')as Date_label1
      ,[Full_date]
      ,[Calendar_year]
      ,[Calendar_quarter]
      ,[Calendar_month]
      ,[Year_of_contract]]
  FROM [dbo].[Dim_Date]
GO

So in your Case you could just use

SET ARITHABORT ON 

Create View [dbo].[view_Name]
 as .....

Just set it when you create the view so just do a Drop and Create To And add that line in and you will be good to go :D

enter image description here