Solved

sp_addlinkedserver problem

Posted on 2006-06-16
10
466 Views
Last Modified: 2006-11-18
I want to copy data from another server to local server. I use sp fopr thois purpose. When I put following code outside of sp, everything works fine. When I put the same code at the beginning of sp - it gives me an error "Could not find server 'ActualSrv' in sysservers. Execute sp_addlinkedserver to add the server to sysservers."

EXEC sp_addlinkedserver @Server='ActualSrv',
                      @srvproduct='SQLServer OLEDB Provider',
                  @provider='SQLOLEDB',
                  @datasrc='SQL_SERV',
                  @catalog='test'

EXEC sp_addlinkedsrvlogin @rmtsrvname='ActualSrv', @useself=false,--@locallogin=current_user,
                  @rmtuser='test,
                  @rmtpassword='test00'

Any ideas what the problem might be ? Thank you.
0
Comment
Question by:nataliyamaks
  • 6
  • 2
10 Comments
 
LVL 20

Expert Comment

by:Sirees
ID: 16922930
Try this in QA

select * from Master..Sysservers

see if 'ActualSrv' exists.

0
 
LVL 20

Expert Comment

by:Sirees
ID: 16922939
Are you linking two SQL Servers?

If so, @srvproduct should be 'SQL Server'

0
 
LVL 20

Expert Comment

by:Sirees
ID: 16922954
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:nataliyamaks
ID: 16923260
@srvproduct  doesn't really matter. It works both ways with no difference. The problem is that the same code works outside of sp and doesn't work in the sp.
0
 
LVL 20

Expert Comment

by:Sirees
ID: 16923299
Are you referring to Master db in your SPs?
0
 

Author Comment

by:nataliyamaks
ID: 16923373
no
0
 
LVL 20

Accepted Solution

by:
Sirees earned 250 total points
ID: 16923492
You are missing '


EXEC sp_addlinkedsrvlogin @rmtsrvname='ActualSrv', @useself=false,--@locallogin=current_user,
               @rmtuser='test',< --you missed a quote here
               @rmtpassword='test00'
0
 
LVL 20

Expert Comment

by:Sirees
ID: 16923506
I tried to create a linked server with code in SP and it worked fine.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert in derived column 7 31
How to share SSIS Package? 6 38
SQL Server Import/Error Wizard error 12 20
access query to sql server 3 22
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

831 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