addlinkedserver

Ok, first my brain hurts :) I have a ssrs server that I need to build a report from two other sql servers.  I have added them as link servers.. I just can't come up with the right query..

this is what i have.. but i know it does not work..

USE master
GO
EXEC sp_addlinkedserver
select *
from
wwscada.VaTfLt.dbo.FlowDaily
join
scadaaldb.AlTfLt.dbo.FlowDaily

I am stuck.. sorry for a stupid question..

Sam

SamRunyonAsked:
Who is Participating?
 
cyberkiwiCommented:
You need to do the link command at the server level, i.e.

If your SQL servers as sql1 and sql2, and you want to run statements from Sql1 linking to sql2, execute this on sql1

exec sp_addlinkedserver sql2  (or exec sp_addlinkedserver [sql2\instancename] if instanced)

Now, the trick is that the current login should work equally on the other server, whether Windows or SQL login/pass.  Otherwise, look up BOL for sp_addlinkedsrvlogin

The above is a one off to link the servers together.
Then, you just run the select normally

select *
from wwscada.VaTfLt.dbo.FlowDaily
join scadaaldb.AlTfLt.dbo.FlowDaily on ......
0
 
RDWaibelCommented:

your query is missing some stuff!
"select *
from
wwscada.VaTfLt.dbo.FlowDaily
join
scadaaldb.AlTfLt.dbo.FlowDaily"
Mainly how the two tables are linked.  Now, if you want all the data from both tables, try:
Select * From wwscada.VaTfLt.dbo.FlowDaily
UNION
Select * From scadaaldb.AlTfLt.dbo.FlowDaily
0
 
cyberkiwiCommented:
Have you tried any of the suggestions?
If you don't understand, please pipe up.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.