OLEDB varchar max not working

k ford 0 Reputation points
2024-04-23T03:49:13.6966667+00:00

Having issues with OLEDB when writing a SQL Query that compares value with VARCHAR(MAX) column for inclusion. I'm wondering if the way that OLEDB connects to a database causes the issue or if it's the adapter itself.

Edit:

The query below by example gives an error when using the OLEDB driver that I'm still working to capture as the OLEDB driver isn't returning the error directly.

OLEDB driver version 18.6.7

Methods tried:

SELECT
*
FROM TABLE
WHERE
1=1
AND VARCHAR_MAX_FIELD = 'VALUE'

also tried


SELECT
*
FROM TABLE
WHERE
1=1
AND CONVERT(VARCHAR(4000), VARCHAR_MAX_FIELD) = 'SMALLER THAN 4000 CHAR VALUE THAT SHOULD WORK'

Within the query above also tried were TRY_CAST, TRY_CONVERT and CAST.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,756 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,686 Reputation points
    2024-04-23T19:50:31.47+00:00

    there is nothing wrong with the original query. It probably is not representative of the actual oledb query. please identify the sql versions and the actual oledb code.

    0 comments No comments