Date Format of Parameters for SSRS

While SQL Server does accept the date format as string, it is suggested to convert it to datetime data type. This will allow you to use a calendar control as well as avoiding any date format errors that may occur when running your query. Indeed, it does cause minor errors internally. The period, it can be:

t.add_datetime >= @StartDate AND t.add_datetime < DATEADD(D, 1, @EndDate)

The trick here is for general public both dates should be inclusive. Above code indeed includes the time from 0:00:00 of the StartDate to 23:59:59 of the EndDate.


http://www.sqlusa.com/bestpractices/datetimeconversion/

No comments:

Post a Comment

Labels