Consultor Eletrônico



Kbase P119210: How to query Progress Database on the link server on the Microsoft SQL Server?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/8/2009
Status: Verified

GOAL:

How to query Progress Database on the link server on the Microsoft SQL Server?

GOAL:

How to query Progress Database on the linked server on the Microsoft SQL Server?

GOAL:

What SQL do I need to use to query Progress Database on the link server on Microsoft SQL Server?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
Windows

FIX:

Use OpenQuery() function to query Progress Database on the SQL Server as the following syntax:

SELECT [*] | [fieldname], ["field-name"] FROM OpenQuery([LINKEDSERVERNAME], 'SELECT [*] | [fieldname], ["field-name"] FROM PUB.[mytable] | ["my-table"]')

SELECT [*] | [fieldname], ["field-name"] FROM OpenQuery([LINKEDSERVERNAME], 'SELECT [*] | [fieldname], ["field-name"] FROM PUB.[mytable] | ["my-table"] WHERE
[fieldname] | ["field-name"] = 123 | ''one''')

The following examples are used with sports2000 database:

-- This example will show all the fields records of the customer table from the sports2000 database:

SELECT * FROM OpenQuery([sqlsport2k], 'SELECT * FROM PUB.customer')

-- This example will show records available pertaining to Massachusetts from the state table of sports2000 database:

SELECT * FROM OpenQuery([sqlsport2k], 'SELECT * FROM PUB.state WHERE state = ''MA''')

-- This example will show custnum and name fields records of the customer table from the sports sports2000 database:

SELECT * FROM OpenQuery([sqlsport2k], 'SELECT custnum, name FROM PUB.customer')

-- This example will show name field records of the customer table from the sports2000 database:

SELECT name FROM OpenQuery([sqlsport2k], 'SELECT custnum, name FROM PUB.customer')