Home » Microsoft » MB6-886 » Which data type should you use?
You are a database developer. You plan to design a database solution by using SQL Server 2008.
The database will contain a table to stage data from an external source. The imported data will contain a field named TransactionTime. The TransactionTime field will use the hh:mm:ss.[n] format (such as 12:55:30.1).
You need to select the appropriate data type for the TransactionTime field. You need to achieve this goal by incurring the minimum amount of storage cost.
Which data type should you use?
A. time
B. smalldatetime
C. datetime2
D. time(1)
Correct Answer: D
Explanation/Reference:
time [ (fractional second precision) ] defines a time of a day in hh:mm:ss[.nnnnnnn] format. The time is without time zone awareness and is based on a 24-hour clock. (Range is 00:00:00.0000000 through 23:59:59.9999999) fractional seconds precision specifies the number of digits for the fractional part of the seconds. This can be an integer from 0 to 7. The default fractional precision is 7 (100ns).
In the current scenario, the TransactionTime field will use the hh:mm:ss.[n] format (such as 12:55:30.1). So we need to use 1 as a fractional seconds precision.