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
 Transact-SQL (2000)
 @TableName

Author  Topic 

Sprinjee
Starting Member

42 Posts

Posted - 2005-08-22 : 17:26:07
Probably posted many times...but searching thorugh the internet I do not get a clear answer (is it possible at all):


CREATE PROCEDURE tabsel
(@TableName AS Nvarchar) AS
DECLARE @sql varchar(1000)
set @TableName = 'MyTable'
set @sql = 'select id from ' + @TableName
exec (@sql)

the command is completed succesfully however I do not get any (grid) results.

Sprinjee
Starting Member

42 Posts

Posted - 2005-08-22 : 17:37:15
Never mind solved it...run the above and afterwards:

DECLARE @sql varchar(1000)
declare @TableName varchar(10)
set @TableName = 'MyTable'
set @sql = 'select id from ' + @TableName
exec (@sql)
Go to Top of Page
   

- Advertisement -