Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. DECLARE @myList TABLE (Id nvarchar(max));
  2.  
  3. INSERT INTO @myList(Id) VALUES ('40098071,40098081');
  4.  
  5. select '''' + REPLACE(id, ',', ''',''') + '''' from @mylist
  6. select destid from [servername].database.[dbo].table where table in (select '''' + REPLACE(id, ',', ''',''') + '''' from @mylist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement