Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting across different database

Status
Not open for further replies.

CRuser89

Programmer
May 18, 2005
79
US
Hello,

I am using SQL Server 2005 and have the following select statement inside a stored procedure. The stored procedure has a bunch of other selects that select from tables in the test1 database and the sp is being run against test1 database. The table in the select statement below is in database test2. How can I reference this table from database test1? Do I just put the database name plus a dot in front of the table? I tried that but it doesn't work.

select max(person_id) from person

Thanks in advance,
Kathy
 
Hi everyone,

I added the database name dot owner dot table and it worked.

Thanks,
Kathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top