Solved

Best SQL Server DataType

Posted on 2015-02-12
3
65 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:
SimonAdept 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

707 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

18 Experts available now in Live!

Get 1:1 Help Now