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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to select from a table in a different database

Author  Topic 

tomex1
Starting Member

47 Posts

Posted - 2008-08-01 : 06:11:55
Hello,
I am trying to run an SQL statement from a database called 'wce_site'. The statement is meant to select some columns from a table called 'wce_users' in a different database called 'wce_system'. How do I write the SQL statement to do this on MS SQL Express?

Thanks in advance!

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-08-01 : 06:14:43
specify it like...

[database].[schema].[table]

Em
Go to Top of Page

VGuyz
Posting Yak Master

121 Posts

Posted - 2008-08-01 : 06:21:12
or

select col1 from table db_name..table_name
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-01 : 12:40:23
quote:
Originally posted by VGuyz

or

select col1 from table db_name..table_name


what is this for?
Go to Top of Page
   

- Advertisement -