How to create a timestamp?

  • Thread starter Thread starter Dean Slindee
  • Start date Start date
D

Dean Slindee

Since SQL Server has a native timestamp datatype, I was expecting .NET to
have a .ToTimestamp function, but evidently not.

Which leads to my question: is a a universally accepted format for a
timestamp? And how would you create it in .NET?

Thanks,
Dean Slindee
 
Dean,
SQL Server's Timestamp is a SQL Server specific data type that is simply an
8-byte structure that is guaranteed to be unique. My understanding is that
SQL Server's Timestamp is simply a sequential number, however that is an
implementation detail that is subject to change, in other words I do not
rely on the fact it may be a sequential number...

The chart at
http://msdn.microsoft.com/library/d.../en-us/cpref/html/frlrfsystemdatasqltypes.asp
shows you the SQL Server data type along with the SQL Client equivalent
lent.

Hope this helps
Jay
 
Dean,

In my opinon should you avoid creating a timestamp yourself, the database
should do that. Think about an almost parallel update by two users. You are
not able to control that (forever right) from your program in my opinion.
That is the difference between a DateTime Now and a TimeStamp.

However when you want to fulfil your needs as you think about it now.
Here a complete sample in a message from David Sceppa, in C#..

http://groups-beta.google.com/group/microsoft.public.dotnet.framework.adonet/msg/5c579f58a8c82144

I hope this helps

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top