Skip to Content.
Sympa Menu

freetds - Re: [freetds] dbdatlen() returns 8 for NULL timestamp / rowversion value

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] dbdatlen() returns 8 for NULL timestamp / rowversion value
  • Date: Sun, 28 Feb 2016 20:35:56 +0000

On 25 Feb 2016 23:10, "Geoff Montee" <geoff.montee AT gmail.com> wrote:
>
> Hi all,
>
> According to MS SQL Server's documentation, the timestamp / rowversion
> data type is equivalent to binary(8) or varbinary(8) depending on
> whether the column is nullable.
>
> "A nonnullable rowversion column is semantically equivalent to a
> binary(8) column. A nullable rowversion column is semantically
> equivalent to a varbinary(8) column."
>
> https://msdn.microsoft.com/en-us/library/ms182776.aspx
>
> I can confirm that FreeTDS's dbcoltype() function returns 45
> (SYBBINARY) as the data type for a timestamp column. I've noticed some
> strange behavior by dbdatlen() though.
>
> If I query a NULL binary(8) or varbinary(8) column, then dbdatlen()
> returns 0, which makes sense for a NULL column. However, if I query a
> NULL timestamp column, then dbdatlen() returns 8. This causes the NULL
> checks in my application (tds_fdw) to say that the column is not NULL.
>
> Is this intentional, or is this a bug?
>
> I noticed this behavior on FreeTDS 0.95.19 on RHEL 7.
>
> Thanks!
>
> Geoff
>

I don't known. Can you send a log (tds dump)?

If I remember the only difference for timestamps and binaries are the
usertype. Possibly binary is always used instead of varbinary.

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page