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 2000 Forums
 SQL Server Development (2000)
 How Can I , Pass , Name (s) of Table (s) to a Store Procedure as a (Set Of) Parameter (s)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-07 : 08:44:43

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2004-09-07 : 08:44:43
Nasser writes "Suppose , St1 was programmed as below:
___________________________________________
Create Procedure St1 @TableName Varchar(50)
As
Select * From @TableName
___________________________________________
But I get an error ,...then ,
How Can I , Pass , Name (s) of Table (s) to a Store Procedure as a (Set Of) Parameter (s)."
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-07 : 08:52:51
you can't u need to do dynamic sql for that:

exec('select * from ' + @TableName)

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -