Wednesday, January 23, 2019

Querying Rich Text Type Field Using MS SQL (Transact SQL)

MS SQL does not have an equivalent data type for CLOBS (the backend data type of rich text fields) hence running a query against a rich text type field via ODBC using a Transact SQL  will throw an error pertaining to the rich text type field.

To get around this, use "to_char" to get the value of the field.

Below is a sample (where REMIT_TO is a rich text type field):

SELECT TRANSACTION_ID, REMIT_TO FROM OPENQUERY(NETSUITE, 'SELECT TRANSACTION_ID, TO_CHAR(REMIT_TO) AS "REMIT_TO" FROM TRANSACTIONS');

No comments:

Post a Comment