Methods for accessing a table in Sybase using SQL Server _ database other

Source: Internet
Author: User
Tags dsn odbc ole sybase sybase client sybase database
Q: How should SQL Server access the tables of the Sybase database?

Answer: The specific method is as follows:

1: Install Sybase client

Requirements for version:

Sybase Client 11.9.2 for NT

1.1: After the installation completes, runs starts-> the program->sybase->dsedit

1.2: Select Menu ' Server Object ',-> ' Add ' to enter service name such as 1.70

1.3: Then select ' 1.70 ' in the server list, double-click the dialog box on the right, and select Add in the Network Address dialog box, such as 132.228.1.70,4300,ok Are you sure

1.4: Select the Ping Server button on the toolbar to test whether the server is connected (red lightning-like button)

2: Establish dsn> in ODBC


Administrative Tools-> Data source ODBC


Create a new System DSN with the name set to 1.70


In the Create New Data Source dialog box, select the ' Sybase System11 ' data source driver,


DSN Datasouce name for the General property: fill in 1.70,


Database: Fill in Sybase database name


OK save


3: Establish a linked server



Enterprise Manager-> Security-> build linked server-> new linked server


3.1: In the regular label column



Name Sybase,


Server type Choose another data source, select in the name of the provider



Microsoft OLE DB Provider for ODBC


Data source: Fill in the DSN name 1.70



3.2: Security column


Local Login Fill SA


Remote users and remote passwords fill in Sybase username and password



3.3: Use this security context to establish a connection



Remote Login Enter Sybase username and password


Enter a password with a password



OK save



4: Login to Query Analyzer with SA identity



You can detect Sybase data by executing the following SQL statement

SELECT * from Linked server name (this example is Sybase). Sybase's database name. dbo.sybase's Table name

Note: If this problem is found when executing a query: The OLE DB provider "MSDASQL" of the linked server "Sybase" provides inconsistent metadata for the column.

WORKAROUND:: Do not use the following statement directly


SELECT * FROM Sybase.dbname.dbo.tablename


Only need to change a statement, can solve the problem. The specific statements are as follows:



SELECT * FROM OPENQUERY (Sybase, ' select * from Dbname.dbo.tablename ')


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.