Converting a string to Query in SQL Server

declare @a varchar(20)
declare @qry nvarchar(200)
set @a = '235,236,237'
set @qry = N'select * from students where stdID in (' + @a + ')'
exec sp_executesql @qry

Comments

Popular posts from this blog

Per-user throttling in SharePoint Online: a Recipe for getting blocked in SharePoint Online and way to Avoid it

Powershell: Filling up an Existing Excel Sheet with data from SQL Server

SharePoint Online: Elevated Permissions....with love