Saturday, August 25, 2007

How to carry "linked servers" from one server to another

Following script extracts linked servers info as sql script output

select 'exec sp_addlinkedserver @server=''' + srvname + '''' + isnull(',@srvproduct=''' + nullif(srvproduct, '')+ '''', '') + isnull(', @provider=''' +nullif(providername, '')+ '''', '') + isnull(', @datasrc=''' + nullif(datasource,'')+ '''', '') from master..sysservers

You can run output script at destination database to create linked servers. However you should carry sacurity settings of each linked server manually

No comments: