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!

SQL Server TSQL

Status
Not open for further replies.

jonsey

Programmer
Jun 17, 2002
3
US
Is it possible to create a parameter that allows a user to enter a table name which will be part of the select statement?
thanks
 
Hi,

u could try something like this...
CREATE PROCEDURE new1 AS
Declare @tablename Varchar(40)
Begin
Declare @Sel as varchar(200)

set @Sel = 'Select * from ' + @tablename + ' Where field1 =''abcd'''
exec (@sel)
End


Sunil


GO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top