Search code examples
sqlsql-serversql-server-2000

Time data type defaults to datetime when creating table


As the title says, when creating a table with a column of time type, the column defaults to datetime type. Is this normal or a bug? Here's the relevant line when creating the table:

Create Table dbo.time(
ColumnOfTime time)

And here's what's created:

ColumnOfTime [DATETIME Nullable]

Again, is this normal or have i done something wrong? Not much of a SQL person and the tinternet doesn't seem to offer much advice. Thanks


Solution

  • If you have SQL Server 2000, you can either use the datetime datatype, and just ignore the date portion when you work with it, or you can store time as a varchar or integer (maybe seconds after midnight) and do the necessary casting and/or calculations when you work with it.