Solved

Best SQL Server DataType

Posted on 2015-02-12
3
66 Views
Last Modified: 2015-02-12
What is the best data type for time-of-day?  Ex: "15:26:58.250"

Thanks!
0
Comment
Question by:Bob Schneider
3 Comments
 
LVL 18

Accepted Solution

by:
Simon earned 250 total points
ID: 40605426
I'd say TIME unless you need timezone awareness.
0
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 250 total points
ID: 40605429
If you only need 2 decimal places, then smalldatetime uses 4 bytes, whereas Time uses 5.

However, you would need to insert a date as well (even a dummy date).

Both of these can be used from SQL Server 2008 onwards.
0
 

Author Comment

by:Bob Schneider
ID: 40605440
I do need three decimal places and I don't want to insert a dummy date but this has been helpful and enlightening.

Thank you both!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now