UnderSeven
asked on
How to reference multiple db's in T-sql
I use one db for storing data, it is built from a restore of another db. We'll call this db REPORT. Another database I put my actual stored procedures and functions on. I'll call this one SPS
Typically this isn't an issue, we simply reference the appropriate db in the FROM clause, but I want to know how I can make it so I can have T-SQl pointed to look in specific places for functions. For isntance, I don't want to have to type 'SPS.DBO.FUNCTIONNAME()' everytime I want to use one of those functions. How can I make it so I just have to type the function name?
Typically this isn't an issue, we simply reference the appropriate db in the FROM clause, but I want to know how I can make it so I can have T-SQl pointed to look in specific places for functions. For isntance, I don't want to have to type 'SPS.DBO.FUNCTIONNAME()' everytime I want to use one of those functions. How can I make it so I just have to type the function name?
ASKER
Is there anyway to include it like you would in a c language? So I can avoid writing anything but the function?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
e.g.
select * from MyDB..MyTable