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
 Transact-SQL (2000)
 one more thing !!

Author  Topic 

lemondash
Posting Yak Master

159 Posts

Posted - 2004-12-08 : 06:30:16
I want to store stopwatch times in a sql table, but can't seem to work it out. I only want to store mm:ss:ms can any body put me in the right direct please.

Lee

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-08 : 06:39:31
datetime stores both date and time. so you can save them but the data in the column will look like 1.1.1900 00:mm:ss:ms
but i don't believe this will affect your functionality. formating data should be in the presentation layer anyways...

Go with the flow & have fun! Else fight the flow
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-08 : 06:42:00
depends on the accuracy you want.
You could use a datetime but that's only accurate to about 3ms.
You could convert to milliseconds and store in a int or bigint maybe.
You could hold in two fields datetime for hh:mm:ss int for ms.
or character field hh:mm:ss.mmm

You only need to worry about holding the data and how you will perform calculations on it. You can format the output for disply.
i.e. don't worry that a datetime also holds the date - you will drop that for presentation.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -