1

I'm a web developer and I want to export a database to work on it in my local machine.

I'm using generate script with data. the script is generated but without the linked servers used by some Views.

Is their a way to generate a full script with linked servers or do I have to create it manually with sp_addlinkedserver?

Tom V
15.8k7 gold badges66 silver badges87 bronze badges
asked Apr 4, 2016 at 10:27

1 Answer 1

3

Linked servers are server-level objects--they are not contained within the database. Therefore you will need to move them separately.

In Management Studio, in the Object Explorer, Navigate to Server Objects --> Linked Servers --> [the linked server you want].

ObjectExplorer

Then just right-click --> Script Linked Server as... --> CREATE to --> [pick a destination]. This will not script out passwords.

If the linked server has stored credentials, you will need to re-input the password. You can either edit the call to sp_addlinkedsrvlogin in the generated script (replace "########" with the real password), or edit the linked server from Management Studio after creating it with the wrong password. Saving the script with the password embedded is not a good security practice, so I generally opt to either edit the script at runtime, or edit the authentication settings after the fact.

answered Apr 4, 2016 at 12:10
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.