开发者

while updating the xml filed i gtting error like this

开发者 https://www.devze.com 2023-03-14 12:16 出处:网络
SELECT failed because the following SET options have incorrect settings: \'ARITHABORT\'. Verify that SET options

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")]/FilePa开发者_Go百科th/text())[1] with sql:variable("@Actual_Path") ') where Id =@Id

end


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号