Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table name parameter in stored procedure

Status
Not open for further replies.

afybim

Technical User
Nov 13, 2002
16
TR
hi,
how can i use a table name as a parameter in a stored procedure.
cam anyone help me?
i have searched forum but i couldn't find right answer.
thanks..
 
If you mean to perform an action on a table which is passed in as a parameter then you need to generate the SQL statement dynamically.

e.g.
Code:
DECLARE @SQL varchar(2000)
SET @SQL = "SELECT * FROM " + @TableParam

EXEC @SQL

James Goodman MCSE, MCDBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top