Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL timestamp type: VB6 equivalent?

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
CA
My VB code is choking on the 8-byte SQL type 'timestamp'. I'm getting a Type Mismatch error. I know that this SQL value is note really a date/time, but rather a binary value. I'm trying to load a timestamp value (via ADO) into a Date variable (also 8 bytes) -Choke. I've also tried a variable of Double type -Choke!
Do I need a custom VB type to work with SQL timestamp values?
-thanks
 
From BOL:
Microsoft® SQL Server™ 2000 includes four types of special data:

timestamp
Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format.

Well, now I'm closer to 100% sure... ;-{)
 
BOL also says timestamp is created by @@DBTS and when a row is modified the timestamp is @@DBTS incremented by 1.

msc0tt,

You could create a database called Replication (or whatever suits you). It would hold information on the tables that have been 'replicated'. For example, one table per table in the original database. Each table could have two columns old_timestamp and current_timestamp. Put a trigger on the original table that copies the timestamp to this new db whenever it changes. Then when you are ready to replicate, compare the timestamps in this database and use them and the tablename to copy only the rows that changed in the original.

-SQLBill
 
Hahahahahaha.......
I do believe we've come full circle. You're describing exactly what I am trying to do. The 'problem' is the VB app that is SYNCing the local and remote table. I need an intermidiate variable to hold the binary timestamp value... but what Type indeed???
Also, what SQL type do I use in my Replication control DB to store the timestamp values - bit8, datetime8, sql-variant, ...?
-thanks
 
How about Byte(8) or even String * 8, both of which will adequately hold 8 bytes.

-------------------------------------
A sacrifice is harder when no one knows you've made it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top