Tuesday, December 18, 2018

Retrieve Custom Long Text Field Data Using OPENQUERY

SQLServer has restrictions on the "TEXT" datatype and "VARCHAR" for the length of the data. Attempting to query a custom long text field with OPENQUERY, will throw an error "Requested conversion is not supported."

To get around this use to_char

Example:
Given linked server NETSUITE_LS and custom long text field CUSTOM_DESCRIPTION in transactions table
 

OPENQUERY(NETSUITE_LS,'SELECT to_char(i.[CUSTOM_DESCRIPTION]) AS "CUSTOM_DESCRIPTION" FROM TRANSACTIONS')

No comments:

Post a Comment