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 |
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2001-05-24 : 15:41:28
|
I have a group of stored procedures in DB1These stored procedures are controlled by a master procedure so:SP1 calls SP2 and SP3I ALSO HAVE DB2 ... DB100the stored procedures where written without fully qualified statementsso in any one stored procedure the statementsare as follows :select id from tbl1not select id from db1.dbo.tbl1I'm wondering If there is a way to use the use command to change databases or a way of executing the stored procedures from DB1 so that they affect tables in the databases they run on.I've triedSET @dbname = 'db2'EXEC 'USE ' + @dbname + ' 'EXEC db1.dbo.sp1'but the stored procedure still affects db1 and not db2.It would be a pain to go through and fully qualify every sql statement so a simpler solution would be nice.Edited by - ValterBorges on 05/24/2001 15:49:05 |
|
|
|
|