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

SharePoint 2010 Migration Woes: Importing and exporting lists template between different SP2010 Servers

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

SharePoint Online: Elevated Permissions....with love