Sunday, March 25, 2012

Connenting to a another SQL Server using Transact-SQL

Hi,

I am finding a solution for how to connect to a SQL server by using Transact-SQL.

Suppose that there are two SQL Servers Call 'A' and 'B'.I just want to connect to the SQL Server 'B' from SQL Server 'A' to Insert data.

How can i do this only using Transact-SQL without using any programming language.

Thanks,

You will have to setup Server B as a linked server on Server A first. Then you will ba able to use frou part notation to access the Server:

Select * from SomeLinkedServerName.DatabaseName.OwnerOrSchema.Objectname

See the linked server topic in the BOL for more information.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment