T-SQL操作XML 数据类型方法 "modify" 的参数 1 必须是字符串文字。

----删除关键字的同时也清理AP表中所有关联这个ID的数据

create trigger Trg_UpdateAppWordOnDelKeyWord

on [dbo].[tbl_KeyWord]

for delete

as

declare @work_id int

select @work_id = Word_Id from deleted

update [dbo].[tbl_APP] set APP_Word.modify('delete /id[.=sql:variable("@work_id")]') where APP_Word.exist('/id[.=sql:variable("@work_id")]') > 0

go

关键字是:sql:variable

你可能感兴趣的:(t-sql)