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.
| Author |
Topic |
|
SQLSeeker
Starting Member
15 Posts |
Posted - 2009-11-05 : 00:45:38
|
| Hi, I want to send table name as parameter to the Stored procedure so that I can do database operation on a table which is in parameter list. How it can be achieved?? |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-05 : 00:51:10
|
| Try like this, /*exec sample 'mytable'*/Create procedure sample @table_name varchar(50)asBeginexec('select * from '+@table_name)EndGo through Dynamic SQL in BOLSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-11-05 : 00:56:21
|
| The thing is like when you going to pass database name or table name using a parameter then you have to use dynamic sql to execute this thing.iF theRe iS a wAy iN tHen theRe iS a wAy oUt.. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|