Q: How does SQL Server access the table of the Sybase database?
A: The specific method is as follows:
1: Install the Sybase Client
Version requirements:
Sybase Client 11.9.2 for NT
1.1: After the installation is complete, run start-> Program-> Sybase-> Dsedit
1.2: Select 'server object' in the menu,-> 'add', and enter the service name, for example, 1.70.
1.3: Select '1. 70' in the Server list, double-click the server address column in the right-side dialog box, and select add in the Network Address Attribute dialog box to fill in the IP address, such as 132.228.1.70, 4300, OK
1.4: select the Ping Server button in the toolbar to test whether the Server can be connected (the red button similar to lightning)
2: Create a DSN in ODBC>
Management tools-> data source ODBC
Create a system DSN named 1.70.
In the create a data source dialog box, select the 'sybase system11' data source driver,
DSN datasouce name of the General attribute: Enter 1.70,
Database: Enter the sybase database Name.
Are you sure you want to save
3: Create a linked server
Enterprise Manager-> Security-> link server-> new link Server
3.1: Regular tab Section
Name Sybase,
Select another data source for the server type and select from the provider name
Microsoft ole db Provider FOR ODBC
Data source: Enter DSN name 1.70
3.2: Security Section
Enter sa for local Login
Enter the user name and password of sybase for the remote user and remote password.
3.3: use this security context to establish a connection
Enter the user name and password of sybase during Remote logon.
Enter the password
Are you sure you want to save
4: log on to the query analyzer as a sa
Run the following SQL statement to check sybase data.
Select * from link server name (sybase in this example). sybase Database Name. dbo. sybase table name
Note: if this problem is found during query execution: The ole db access interface "MSDASQL" of the linked server "sybase" provides inconsistent metadata for columns.
Solution: do not directly use the following statements:
Select * from sybase. dbname. dbo. tablename
You only need to change the statement to solve the problem. The statement is as follows:
Select * from openquery (sybase, 'select * from dbname. dbo. tablename ')