Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Extraction of field of timestamp type to C++

Author  Topic 

hippu
Starting Member

10 Posts

Posted - 2004-07-02 : 07:35:47
Hello,

I am attempting to extract filed values from DB to C++

I use the following way -
From ADODB::_RecordsetPtr we extract ADODB::_ADO FieldPtr on which apply GetValue() function.
The code sample -
_variant_t val = pRec->Fields->Item[_T("ColName")]->GetValue();

For timestamp type of column val is coming junk.

Please note I am using stroed procedures to get data and I need to extract timestamp column to implement optimistic concurrency.

Please suggest any clue.

Regards,
Hippu

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-07-02 : 08:02:24
There is no such datatype as timestamp in SQL Server...

EDIT: Glad its friday...
Go to Top of Page

hippu
Starting Member

10 Posts

Posted - 2004-07-02 : 08:29:04
No... there exists
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-07-02 : 08:34:33
There is timestamp, but even M$ don't recommend using it...

From BOL:
quote:

The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.

A future release of Microsoft® SQL Server™ may modify the behavior of the Transact-SQL timestamp data type to align it with the behavior defined in the standard. At that time, the current timestamp data type will be replaced with a rowversion data type.

Microsoft® SQL Server™ 2000 introduces a rowversion synonym for the timestamp data type. Use rowversion instead of timestamp wherever possible in DDL statements. rowversion is subject to the behaviors of data type synonyms.

Go to Top of Page

hippu
Starting Member

10 Posts

Posted - 2004-07-02 : 08:36:38
Thanks Rick,

But we need to use it while achieving optimistic cuncurrency.

Regards,
Hippu
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-07-02 : 08:38:46
Not knowing a great deal about C++, I would hazard a guess that the problem is due to timestamp being a binary or varbinary field...
Go to Top of Page
   

- Advertisement -