Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Stored Procedure - parameters to define table Name

Author  Topic 

DANILOPF
Starting Member

3 Posts

Posted - 2011-08-04 : 20:09:02
Hi,

It's possible to use a parameter in stored procedure to define a table name. How can I do this?

Thank you,
Danilo

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-04 : 20:19:27
Yes, but if you want to then query it, you'd have to use dynamic SQL. Not a good idea. Read through this: www.sommarskog.se/dynamic_sql.html

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -