Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to deal with ' in Openquery?

Author  Topic 

Mathias
Posting Yak Master

119 Posts

Posted - 2002-04-30 : 06:37:51
I have linked through OLE ODBC another database (Oracle RDB)
in the SQL statement I have the following :

select cast(PEND.PEND_FUND as varchar(8)) || '-' || PEND.PEND_TRAN_NUMBER as key from ...

The server doesn't like the quotation but this is the required syntax for Oracle. Should I use a @temp variable?

izaltsman
A custom title

1139 Posts

Posted - 2002-04-30 : 08:26:43
You could use a variable, or you could try to double up your single quotes like so:

select cast(PEND.PEND_FUND as varchar(8)) || ''-'' || PEND.PEND_TRAN_NUMBER as key from ...[/i]



---------------
Strong SQL Developer wanted in the Boston area. Please e-mail if interested.
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-30 : 08:26:50
select cast(PEND.PEND_FUND as varchar(8)) || ''-'' || PEND.PEND_TRAN_NUMBER as key from ...


HTH

SNIPED AGAIN !!

--------------------------------------------------------------


Edited by - Nazim on 04/30/2002 08:28:12
Go to Top of Page

seevo
Starting Member

3 Posts

Posted - 2002-04-30 : 16:16:04
Use double tick marks -- '' ''

Go to Top of Page
   

- Advertisement -