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 2008 Forums
 SQL Server Administration (2008)
 Advise for column type

Author  Topic 

bpsintl
Posting Yak Master

132 Posts

Posted - 2010-11-17 : 10:36:43
Hi all, I have a database for swim times and the "swim_time" column is basically a varchar column in this format 'mm:ss:ms' where mm = munites, ss = seconds and ms = milliseconds

What are your comments on storing the swim time in this "varchar" format? I'm guessing it wasn't the best decision but I'm looking to change it.

The table has quite a few records in it and I have queries that return times ordered by the fastest time and I'm thinking that I could probably make results faster by storing the swim time in a different format.

Any comments?

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-11-17 : 10:53:58
Why not use TIME?!?

http://www.sqlteam.com/article/using-the-time-data-type-in-sql-server-2008
Go to Top of Page

bpsintl
Posting Yak Master

132 Posts

Posted - 2010-11-17 : 10:57:38
I did look at that but does TIME not have to be hh:mm:ss?
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-11-17 : 10:58:55
Have a look at the link, it can be what you want. You have hours, but you don't need to use them.
Go to Top of Page

bpsintl
Posting Yak Master

132 Posts

Posted - 2010-11-17 : 11:00:29
Ah, ok cool. I'll look into using that. Thanks
Go to Top of Page
   

- Advertisement -