locked
Using SQLBindCol to get column length of unbound long data column RRS feed

  • Question

  • Hello,

    according to the documentation of SQLBindCol it should be possible to get only the column length information by setting TargetValuePtr to NULL and StrLen_or_IndPtr to a valid value:

    TargetValuePtr

    ...

    If TargetValuePtr is a null pointer, the driver unbinds the data buffer for the column. ... An application can unbind the data buffer for a column but still have a length/indicator buffer bound for the column, if the TargetValuePtr argument in the call to SQLBindCol is a null pointer but the StrLen_or_IndPtrargument is a valid value.

    I tried that, but StrLen_or_IndPtr does not get filled.

    My idea is to get the length of an unbound long data column this way and then later call SQLGetData only if the length is > 0.

    What am I doing wrong?

    Wednesday, September 28, 2016 10:25 AM

All replies

  • Check if this one can help:http://stackoverflow.com/questions/21204938/how-to-determine-the-correct-buffer-size-for-sqlbindcol

    and you can refer to https://msdn.microsoft.com/en-us/library/ms713532(v=vs.85).aspx

    Thursday, September 29, 2016 10:29 AM
  • Sorry, but I don't understand how this could help me.

    I've tried to use "SQLGetDescField" from the first link.

    For "SQL_DESC_DISPLAY_SIZE" and "SQL_DESC_LENGTH" for the long data field I get 1073741823!

    Friday, September 30, 2016 7:52 AM