Today we are going to see a small yet effective example of how to create Linked Server in SQL server for Sybase
Connect to SQL Server Instance -> Expand Server Objects folder -> Right click on Linked Server ->
select New Linked Server… as shown in the below figure.
Go to the General page of New Linked Server window and fill the property values as shown in the below figure.
Linked Server : <give a name to the Linked server which you are about to create>
Provide: <select Microsoft OLE DB Provider for SQL Server >
Data Source : <DSN name of Sybase Provider>
Catalog : <Sybase DB name >
Go to the Security page and give the credentials to connect Sybase server as shown in below figure.
Go to the Server Options page and set the properties values as shown in the following figure.
Following are few queries which will be usefull while working on Linked server.
–To count rows
EXEC (‘SELECT COUNT(1) FROM <SYBASEDBNAME>.dbo.<SYBASETABLENAME>’) at SYBASE_LINK
–To Insert rows
insert OPENQUERY([SYBASE],’SELECT <SYBASECOLUMNNAME1, SYBASECOLUMNNAME2, SYBASECOLUMNNAME3 from <SYBASEDBNAME>.dbo.<SYBASETABLENAME>’)
SELECT <SQLSERVERCOLUMNNAMES> from <SQLSERVERDBNAME>.dbo.<SQLSERVERTABLENAME>
I would like to have feedback from my blog readers.
Please post your feedback, question, or comments about this article.