Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

referencing remote SQL Server instance

Posted on 2006-06-28
2
319 Views
Last Modified: 2008-03-17
I have this query I want to run against my local server and another server.  I have done all the sp_addlogin crap.  Normally it is easy, I just do servername.databasename.owner.table, but with this particular update, I have a problem

update [dataserver].xyz_rbg.dbo.masterorg  set dst_identifier = null
where dst_identifier is not null and
not exists (select * from distrib where distrib.dst_identifier = dataserver.xyz_rbg.dbo.masterorg.dst_identifier)

but I get the error "The number name 'dataserver.xyz_rbg.dbo.masterorg' contains more than the maximum number of prefixes. The maximum is 3."  I cannot alias the table in an UPDATE as I would in a SELECT.

I've run into this before, and I usually just hack a way (do it from the other end, rename the column so I don't need to prefix it, copy data around, etc.), but I'm getting sick of it.  Am I doing something wrong?  
0
Comment
Question by:JohnBPrice
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17004796
update x set dst_identifier = null
from [dataserver].xyz_rbg.dbo.masterorg  x
where dst_identifier is not null and
not exists (select * from distrib where distrib.dst_identifier = x.dst_identifier)
0
 
LVL 16

Author Comment

by:JohnBPrice
ID: 17004890
Once again you save my butt.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question