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)
 Select from remote server

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-01-25 : 03:23:36
what are the differences when query from remote server using these
Select count(*) from SERVER1.dbTest.dbo.tableA

Select count(*) from [SERVER1\USERTEST].DB1.dbo.TABLE_A


If i connect to database SERVER1 with using sa account, and create a new user newUser,
can I reconnect to the database as newUser, and query in this way?
Select count(*) from [SERVER1\newUser].DB1.dbo.TABLE_A

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-01-25 : 04:34:41
Just get confirmed that USERTEST is actually referring to named instance....

Select count(*) from [SERVER1\USERTEST].DB1.dbo.TABLE_A

But I have another problem for the query in asp.net and get error msg 'no table found...'. DATABASE1 is running on default instance.
SELECT COUNT(*) FROM SERVER1.DATABASE1.dbo.tbl_User WHERE UserID = 'ADM' and Password = 1234


Please help!!
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-01-25 : 10:13:03
Is the server1b set up as a linked server?

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-01-25 : 11:43:22
Set up as a linked server with the user
and type following query:
SELECT COUNT(*) FROM [SERVER1\USERTEST].DATABASE1.DBO.tbl_User WHERE UserID = 'ADM' and Password = 1234
Go to Top of Page
   

- Advertisement -