SQL Server 2008 Date parameter -
i'm passing start date , end date parameter stored procedure. i'm doing simple test here:
declare @startdate date = '10/06/2013' --dd/mm/yyyy select @startdate -- statement running declare @enddate date = '30/06/2013' --dd/mm/yyyy select @enddate -- statement giving error
this statement returns following error
msg 241, level 16, state 1, line 2
conversion failed when converting date and/or time character string.
does have idea what's going wrong enddate
?
i'm pretty sure error on line:
declare @enddate date = '30/06/2013' --dd/mm/yyyy
not on select
. wouldn't make sense on select
, because processing variable should fine.
i recommend use yyyymmdd
formats. following preference:
declare @enddate date = '2013-30-06' ;
however, can fail internationalization settings. following documented work:
declare @enddate date = '20133006' ;
Comments
Post a Comment