Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 dbo and dsn

Author  Topic 

weazy
Starting Member

7 Posts

Posted - 2006-06-08 : 13:12:44
I have a dsn that defaults to database1. I have permissions on database2. How do I indicate in the query to use database2?

I am currently using:

$sql1 = "SELECT field FROM dbo.database2.table WHERE dbo.database2.table3.field = '". $field ."' AND dbo.database2.table3.field1 = dbo.database2.table4.field2";

I get:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.database2.table'., SQL state S0002 in SQLExecDirect in

thanks.

Kristen
Test

22859 Posts

Posted - 2006-06-08 : 14:24:46
SELECT field FROM database2.dbo.table ...

Kristen
Go to Top of Page

weazy
Starting Member

7 Posts

Posted - 2006-06-08 : 15:02:05
thanks.
Go to Top of Page
   

- Advertisement -