Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
    
Think you! that works – aboamin12 yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.