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 2000 Forums
 Transact-SQL (2000)
 Select Query from other server

Author  Topic 

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-08-12 : 13:54:42
Hi
iam running a query from one SqlServer query analyzer and wants to get data from other sqlserver. both server are on network and using windows authentication. can some one help me

i guess it would be like this
Select * from (-sqlserver connection string-).databasename.dbo.table

but i need sql connection string and if someone has better solution
Thnx

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-08-12 : 14:22:01
now iam running this

Select field1, field2 from OPENDATASOURCE('SQLOLEDB','Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DB1;Data Source=SQL1').DB1.dbo.TableName

But i have an error
erver: Msg 18456, Level 14, State 1, Line 1
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

can some help me
Go to Top of Page

schuhtl
Posting Yak Master

102 Posts

Posted - 2004-08-12 : 15:46:12
Have you tried setting up linked servers?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_12_9ooj.asp

Once you have your servers linked you can query the remote server like this:
Select field1, field2 from REMOTESERVER.DB1.dbo.TableName
Go to Top of Page

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-08-12 : 16:37:45
Thnx

I got that thing before, and its working fine

thnx anyways
Go to Top of Page
   

- Advertisement -