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
 Linked server query

Author  Topic 

hayko98
Starting Member

29 Posts

Posted - 2010-07-26 : 19:03:15
Hi,
We have 2 servers: PRD and DEV (PRD has 2 extra weeks of data).They are linked thru SQLNCLI Provider.This is
my query:
SELECT COUNT(*) FROM PRD_SERVER_name.PRD_DB_name.dbo.PRD_TABLE_name.
When I connect to DEV Server and run this query, I am getting results
of DEV_DB even though my query points to PRD Server. Anybody can
explain why is this happening?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-26 : 19:24:39
Your linked server isn't configured correctly or an alias is pointing you to the wrong location.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

hayko98
Starting Member

29 Posts

Posted - 2010-07-26 : 19:35:51
How do i fix this
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-26 : 19:37:12
Check the linked server configuration in Management Studio.

Also check if an alias exists for the following path in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-26 : 19:37:25
Question also asked on SSC: http://www.sqlservercentral.com/Forums/Topic959141-1292-1.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

hayko98
Starting Member

29 Posts

Posted - 2010-07-26 : 19:44:26
Thank You
Go to Top of Page

hayko98
Starting Member

29 Posts

Posted - 2010-07-30 : 14:30:40
Hi Tara,
One of suggestions(by Erland Sommarskog) was drop and recreate linked server, which I did
and did not get results that I was looking for. Then I decided to
restart the DEV server .Then I dropped again and recreated new linked
server. BINGO!!! It worked.

Thanks for your time and affort
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-30 : 14:43:42
Great! Thanks for the follow-up.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -