Consultor Eletrônico



Kbase P45330: Query Analyzer requires string values be surrounded by two single quotation marks
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   27/01/2009
Status: Verified

SYMPTOM(s):

Error querying table via a linked server in MSSQL 2000

A specific string value from a character field being queried

Following query succeeds in SQLExplorer:

select * from pub.customer where "sales-rep" = 'DKP'

Following query for character string fails in Query Analyzer

SELECT * FROM OPENQUERY (GREG,SELECT * FROM pub.customer WHERE "sales-rep" = 'DKP')

Following query for integer value succeeds in Query Analyzer:

SELECT * FROM OPENQUERY (GREG, 'SELECT * FROM pub.customer WHERE "cust-num" = 10')

Line 1: Incorrect syntax near 'DKP'.

FACT(s) (Environment):

Windows
OpenEdge 10.x
Progress 9.x

CAUSE:

In MSSQL Server 2000, the string value must in surround with two single quotations marks (example: ''value''.)

FIX:

The following query works:

SELECT * FROM OPENQUERY(GREG,'SELECT * FROM pub.customer WHERE "sales-rep" = ''DKP''')