[dba-SQLServer]Call another db from sproc

Francisco H Tapia my.lists at verizon.net
Thu May 15 13:29:20 CDT 2003


You can do this in any part of the sproc, such as
YourDBA.dbo.sprocName
calls the following
Select * From YourDBb.dbo.TableName
or even
Select * From Db_A.dbo.TableName AS A Inner Join Db_B.dbo.TableName AS B on
A.CommonField = B.CommonField

and as Charles suggested, check the BOL :o)

HTH's
-Francisco
http://rcm.netfirms.com

On Thursday, May 15, 2003 10:58 AM [GMT-8],
Wortz, Charles <CWortz at tea.state.tx.us> wrote:

: Mark,
:
: It T-SQL you reference a table in another db using the IN clause in
: which you give the path name to the db containing the table.  You
: should be able to find info about this in BOL.
:
:
: Charles Wortz
: Software Development Division
: Texas Education Agency
: 1701 N. Congress Ave
: Austin, TX 78701-1494
: 512-463-9493
: CWortz at tea.state.tx.us
:
: -----Original Message-----
: From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com]
: Sent: Thursday 2003 May 15 12:46
: To: SQLServerList
: Subject: [dba-SQLServer]Call another db from sproc
:
:
:
: Is there a way to reference DatabaseA from within a sproc on
: DatabaseB?
:
: We have a need to select data from a table in a different database.
:
:
:
: Thanks,
:
: Mark Boyd
:
: Sr. Systems Analyst
:
: McBee Associates, Inc.
:
:
:
:
:
:
:
:: _______________________________________________
:: dba-SQLServer mailing list
:: dba-SQLServer at databaseadvisors.com
:: http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
:: http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list