Geeks With Blogs

News


Rodney Vinyard - .NET & SQL Developer When all is said and done, more will be said than done

CREATE PROCEDURE [dbo].[spr_ProcName]

@variableText varchar(3900) = null

AS

declare @ssql nvarchar(4000)

set @ssql = 'SELECT '

set @ssql = @ssql +' , duhColumn

set @ssql = @ssql +' FROM duhTable

set @ssql = @ssql +' where duhColumn in (''' + @PV_variableText  + ''')'

print @ssql

exec sp_executesql @ssql

END

 

 

 

 

 

 

 

Posted on Sunday, July 16, 2006 4:01 PM SQL Server 2005 Tricks | Back to top


Comments on this post: dynamic SQL string execution

# re: dynamic SQL string execution
Requesting Gravatar...
Elegant couture designer evening gowns, sexy dresses, inexpensive on sale prom dresses,
bridesmaid dresses
Left by G on Mar 29, 2010 12:37 AM

# re: dynamic SQL string execution
Requesting Gravatar...
Thanks alot for sharing this with us, was a great post and very helpful as I've only just started learning this language.
Left by canvas print on Jun 20, 2011 5:41 AM

# re: dynamic SQL string execution
Requesting Gravatar...
I can't solve this problem, i am working on slip rings assembly
Left by slip ring on Jan 20, 2013 10:09 AM

Your comment:
 (will show your gravatar)


Copyright © Rodney Vinyard | Powered by: GeeksWithBlogs.net