You are here: Re: Tough query? « MsSQL Server « IT news, forums, messages
Re: Tough query?

Posted by Erland Sommarskog on 08/05/06 22:12

DFS (nospam@dfs_.com) writes:
> Does SQL Server have problems recognizing m/d/yyyy? I hadn't heard.

It may have. Try this:

SET LANGAUGE German
go
SELECT convert(datetime, '9/5/2003')

Not talking about that many readers in this newsgroup find strings like
8/29/2006 as pure garbage if it supposed to be a date. There are only
12 months per year where I live.

There are three safe formats in SQL Server:

YYYYMMDD
YYYY-MM-DDTHH:MM:SS[.fff]
YYYY-MM-DDZ

T and Z here represent themselves. The last format is only in SQL 2005.
All other formats are ambiguous and can be interpreted differently
depending on the langugae setting.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

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

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