开发者

Strange sql error after migrating to a new laptop

On Windows Seven (32 bit) and Sql Server Express 2008 (32 bit)

I successfully run a query like this:

SELECT * FROM tblEmballagesScheduling WHERE StartDate <= '2011/03/14'

Today, I bought a new laptop with Windows Seven (64 bit) and installed Sql Server Express 2008 (64 bit) and I got the error below for the same query:

Msg 242, Leve开发者_如何学Cl 16, State 3, Line 1

La conversion d'un type de données varchar en type de données smalldatetime a créé une valeur hors limites.

English translate:

The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range smalldatetime value.

I don't know what's wrong ??

Thanks in advance for your help.


Can you try and see if this query works??

SELECT * FROM tblEmballagesScheduling WHERE StartDate <= '20110314'

I'm using the ISO-8601 date format (YYYYMMDD - or YYYY-MM-DDTHH:MM:SS), which is language independent and works will all regional and data format settings in SQL Server.


It's the localization setting. The setting your laptop now has set is in the format YYYY/dd/mm, and there is no month 14.


Based n the fact that you're reporting the error message in a foreign language, is it possible that the date format '2011/03/14' doesn't match your localization settings?


Uninstalling the french version of Sql Server Express 2008 then installing the english version of Sql Server Express 2008. Then the query with date fields are correctly interpreted (year/month/day).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜