|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SP QuestionHi,
I am working with two db's and I am wondering if I can query both db in one SP? Basically, I am trying to extend a third party db app by adding a custom db that holds new business data. I need to query both dbs in a SP. Can I do this? Thanks Yes,
SELECT a.col1, b.col2 FROM localdb.dbo.table1 a INNER JOIN otherdb.dbo.table2 b ON a.something = b.something Show quote "William" <will***@email.com> wrote in message news:ud2gU6bqFHA.3720@TK2MSFTNGP14.phx.gbl... > Hi, > > I am working with two db's and I am wondering if I can query both db in > one SP? Basically, I am trying to extend a third party db app by adding a > custom db that holds new business data. I need to query both dbs in a SP. > Can I do this? > > Thanks > On Thu, 25 Aug 2005 15:42:33 -0600, William wrote:
>Hi, Hi William,> >I am working with two db's and I am wondering if I can query both db in one >SP? Basically, I am trying to extend a third party db app by adding a >custom db that holds new business data. I need to query both dbs in a SP. >Can I do this? Yes - use three-part naming: SELECT column1, column2, ... FROM database.owner.tablename Or, if the other database is living on a differnet server, use four-part naming: SELECT column1, column2, ... FROM server.database.owner.tablename Best, Hugo -- (Remove _NO_ and _SPAM_ to get my e-mail address) |
|||||||||||||||||||||||