How to access a table in Sybase using SQL Server

Source: Internet
Author: User
Tags sybase sybase client sybase database

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, start running->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 ')

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.