Page 1 of 1

rowversion as column datatype

Posted: Thu 17 Nov 2016 14:18
by dupe
Hello,

we are using the rowversion datatype in our SQL Server tables.
Now we want to copy a record in our application.
But this record is made up with different JOIN's.
In the past we determined the rowversion column with its name "TS".
Now SDAC creates multiple columns for each joined table. So we have columns called "TS_1", "TS_2" and so on.
If we check those columns we get the field information as ftBytes.
We think this is because SQL Server treats rowversion as a binary(8) column.

So our question is how we can check if its a rowversion column or not?

Best regards

Re: rowversion as column datatype

Posted: Wed 23 Nov 2016 08:33
by azyk
To solve the described issue, you can check a value of the TMSFieldDesc.IsTimestamp property for the field - a True value means that the field data type is timestamp (rowversion). The code example can look like this:

Code: Select all

var
  i: integer;
  FieldDesc: TMSFieldDesc;
  Field: TField;
begin
...
  MSQuery.Open;
  for i := 0 to MSQuery.Fields.Count - 1 do begin
    Field := MSQuery.Fields[i];
    FieldDesc := TMSFieldDesc(MSQuery.GetFieldDesc(Field));

    if FieldDesc.IsTimestamp then ...
To use TMSFieldDesc, add the MSClasses unit into the uses clause.