You are here: Re: formatting for a birth date field?? « MsSQL Server « IT news, forums, messages
Re: formatting for a birth date field??

Posted by David Portas on 11/28/79 11:58

tlyczko wrote:
> Hello, I'm new to SQL Server, working for a non-profit computerizing a
> lot of its data.
>
> I imported a table of people's names, birth dates, etc. into SS2005
> from Access, and the birth_date was imported as an Access date/time
> field, giving it the datetime datatype in SQL.
>
> The column values look like:
>
> 10/14/1964 12:00:00 AM
>
> Where and how do I learn to specify that all fields like this should be
> in ISO format of yyyy-mm-dd??
>
> Do I have to create a new column and put all the dates into it??
> Should I just convert the data in queries/views??
> Use a constraint to format the data??
> I can redo the Access table if necessary, it is only 300-some rows.
>
> I tried BOL but it was not helpful...
>
> The end users will likely enter mm/dd/yy or mm/dd/yyyy and it will have
> to be stored properly in the database table as column/field
> birth_date...
>
> Thank you, Tom

A DATETIME column doesn't have any specific format. SQL Server cannot
control the format of dates as displayed by your client application.
For that you have to use the features of your client app or development
environment.Typically these might be based on the regional format
defined in Windows Control Panel.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация