Creating a link between two SQL servers

To create a link between two SQL Servers you need to use the sp_addlinkedserver and sp_addlinkedsrvlogin stored procedures.
First,
[code]
sp_addlinkedserver @server=’DBLINK01′,@srvproduct=”,@provider=’SQLOLEDB’,@datasrc=’SQL-HOU-01′;
[/code]
Where,
@server is the name of the link
@srvproduct is the type of product, by default SQL Server
@datasrc is the server you link to
Then, you need to set the username and password to use on the link.
[code]
sp_addlinkedsrvlogin ‘DBLINK01′,’false’,null,’sa’,’Pa$$w0rd’;
[/code]
The first parameter is the name of the link to use,
The fourth is the account of the remote server to use,
The fifth is the password for the account.