Stored procedure question
Posted on 2004-10-13
I have a problem that im trying to solve. We have lets say 3 Databases
All these databases have the same Table "Contacts" It has the same structure (FirstName,Lastname,address,etc....) What I want to do is have one stored procedure somewhere instead of three stored procedures in the 3 different databases.
DB Names (Same instance of SQLserver)
All these 3 databases have the same contacts Table.
How could I use one stored procedure for the 3 databases?
So if I called lets say SP_getallcontacts and im currently connected (IN ASP) to Test_DB1 how can that stored procedure know that I want to get the contacts from Test_DB1?