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 |
|
boreddy
Posting Yak Master
172 Posts |
Posted - 2008-09-29 : 03:13:59
|
| I need to write a stored procedure which insert data into a table. In the in-parameter list procedure will get a database name, based on the inparameter db name I need to connect to that database and insert the data into a table, my question is how to change the database name dynamically.Please guide meThanksHazarat Reddy B |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 03:19:10
|
| its not possible to do this dynamically. however you could use system sp sp_Msforeachdb to execute your code on all dbs on your server. |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-29 : 04:28:44
|
| I wonder why you would want to do that ? why not use a temp table and drop it after use |
 |
|
|
|
|
|