create proc dbo.usp_UpdateExclude (@list varchar(150))
as
begin
set nocount on;
declare @xml xml = '<r>' + replace(@list, ',', '</r><r>') + '</r>';
update dbo.Table1
set
Exclude = 'Out of Footprint'
where [State] in (
select
r.x.value('.[1]', 'char(2)')
from @xml.nodes('r') r(x)
)
set nocount off;
end;
go
-- example usage:
exec dbo.usp_UpdateExclude 'MS,TN,TX'; -- this will update 3 rows
[1]:
https://ask.sqlservercentral.com/questions/8413/how-to-send-the-datatable-from-cnet-to-sqlserver-2.html [2]:
https://ask.sqlservercentral.com/questions/8438/how-to-update-the-session-datatable-from-cnet-to-s.html
18 People are following this question.