Q
Problem solve Get help with specific problems with your technologies, process and projects.

Personalized time column

SQL Server Development expert Greg Low explains how to display time in the date column.

I want to have only the time occupy the date column without the mmddyyyy. In SQL Server 2000, can this be done with smalldatetime or datetime?
While the datetime values always have a date component, you can easily create a user-defined function that strips that out when it is accessed. Each time you retrieve the time, just wrap it in that function.

Alternately, what I've also seen people do is to store the time as an int or bigint via your own encoding scheme....

You could, for example, store the time as the number of seconds since midnight.

View questions and answers from all of our SQL Server experts here.

This was last published in March 2006

Dig Deeper on SQL-Transact SQL (T-SQL)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close