umaShankar godi
SSC Veteran
Points: 213
More actions
November 30, 2003 at 9:15 pm
#59097
Hi All
I want to produce 'select * from @table' results,@table assigns value at runtime based onuser parameters.
Is it possible to do so. I Have tried with
sp_executesql peococedure,but it is not
working.
Any Suggestions
Regards
Umashankar
UmaShankar
jordanac
Hall of Fame
Points: 3653
December 1, 2003 at 12:42 am
#484080
I hope that this is what you were asking for....
CREATE PROCEDURE usp_dynamic
@TableName varchar(128)
as
DECLARE @SQLstmnt nvarchar(1000)
SET @SQLstmnt = 'SELECT * FROM ' + @TableName
EXEC sp_executesql @SQLstmnt
GO
If it aint broke don't fix it!
Andy.
December 3, 2003 at 12:29 am
#484402
Thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply