sql server - DATEADD error when use French language? -
i have sp needs calculate date & time. works fine when language set english. however, when french, has error:
la conversion d'un type de données varchar en type de données datetime créé une valeur hors limites.
which means datetime overflow based on translation.
the query similar to:
set language 'french' declare @startpastdays int set @startpastdays = 1; declare @pastdays int set @pastdays = 30; print convert(varchar(10),getdate(),111) print convert(date,getdate(),111) print dateadd(day, -(@pastdays+@startpastdays-1), convert(varchar(10),getdate(),111) ) print dateadd(day, -(@pastdays+@startpastdays-1), cast('2013-07-23' date))
if run it, result is:
le paramètre de langue est passé à français.
2013/07/23
2013-07-23
msg 242, level 16, state 3, line 16 la conversion d'un type de données varchar en type de données datetime créé une valeur hors limites.
2013-06-23
the error happens at: print dateadd(day, -(@pastdays+@startpastdays-1), convert(varchar(10),getdate(),111) )
anyone knows why?
try this
set language french set dateformat ymd go
Comments
Post a Comment