?
Solved

sp_addlinkedserver problem

Posted on 2006-06-16
10
Medium Priority
?
488 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
[X]
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
  • 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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 1000 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

771 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