-1

SELECT failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.

Can anyone say what problem in the following statements

while(@CountOfFile>=@Inc)
begin
    SELECT  @FileName = Attachments.value('(/Files/File[@Id=sql:variable("@Inc")]/Name/text())[1]','nvarchar(50)')  FROM   MOD_Quiz where Id = @Id
    select @FilePath = Attachments.value('(/Files/File[@Id=sql:variable("@Inc")]/FilePath/text())[1]','nvarchar(50)')  FROM   MOD_Quiz where Id = @Id

  set   @Actual_Path  =  @FilePath  +  '/' +  @Id  + '/' + @FileName 
  set  @Inc=@Inc+1

  update MOD_Quiz set Attachments.modify('replace value of (/Files/File[@Id=sql:variable("@Inc")]/FilePath/text())[1] with sql:variable("@Actual_Path") ') where Id =@Id

end
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Raj
  • 1
  • 1
  • If you post code, XML or data samples, **please** highlight those lines in the text editor and click on the "code samples" button ( `{ }` ) on the editor toolbar to nicely format and syntax highlight it! – marc_s Jun 21 '11 at 05:06
  • If you use `SQL Server` please have a look at my answer on [Failed because incorrect arithabort setting](http://stackoverflow.com/questions/35140159/failed-because-incorrect-arithabort-setting/35750269#35750269) page. Hope this helps... – Murat Yıldız Mar 02 '16 at 14:42

1 Answers1

0

As the error says: there's nothing wrong with your SELECT statements, but there's something wrong with your general SET ARITHABORT setting.

As this article on TechNet explains, for an indexed view or XML data type methods, you need to have SET ARITHABORT ON. So put that statement before yours and you should be fine.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459