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

Problems inserting dates

I am trying to insert a value like 18/7/2002 in a column of a table which is smalldatetime data type. But instead of inserting the date 18/07/2002, it is inserting 01/01/1900.

Date values must be enclosed in quotes for these to be interpreted correctly. Remember / is also the divide operator, so what you are trying to insert into your date value is 18 divided by 7 divided by 2002. Enclosing within single quotes, e.g. '18/7/2002' will fix the problem, however as this date format is subject to regional issues, I always recommend that people use the YYYYMMDD format as this works correctly for all regions, e.g. '20020718'.

 

For More Information

This was last published in July 2002

Dig Deeper on Microsoft SQL Server Installation

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.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close