Query with single quotes using OPENROWSET

Query with single quotes using OPENROWSET

am 20.07.2005 14:16:58 von billmiami2

I'm trying to pass through a SQL statement to an Oracle database using
OPENROWSET. My problem is that I'm not sure of the exact syntax I need
to use when the SQL statement itself contains single quotes.
Unfortunately, OPENROWSET doesn't allow me to use parameters so I can't
get around the problem by assigning the SQL statement to a parameter of
type varchar or nvarchar as in

SELECT *
FROM OPENROWSET('MSDAORA','myconnection';'myusername';'mypassword ',
@chvSQL)

I tried doubling the single quotes as in

SELECT *
FROM OPENROWSET('MSDAORA','myconnection';'myusername';'mypassword ',
'SELECT *
FROM A
WHERE DateCol > To_Date(''2002-12-01'', ''yyyy-mm-dd'')'
)

But that didn't work. Is there a way out of this?

Thanks,

Bill E.
Hollywood, FL

Re: Query with single quotes using OPENROWSET

am 20.07.2005 19:19:20 von billmiami2

I take it back--doubling the single quotes is working fine now. I
don't know why I had trouble before.

Bill