Home > Archive > Microsoft SQL Server forum > July 2005 > Query with single quotes using OPENROWSET









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Query with single quotes using OPENROWSET
billmiami2@netscape.net

2005-07-20, 7:23 am

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';'myu
sername';'mypassword
',
@chvSQL)

I tried doubling the single quotes as in

SELECT *
FROM OPENROWSET('MSDAORA'
,'myconnection';'myu
sername';'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

billmiami2@netscape.net

2005-07-20, 1:23 pm

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

Bill

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com