when i use convert(varchar,convert(date, [Date], 103),101)
if data is not available on particular date this query is fetching next date data .
Above statement is untrue!
SELECT convert(varchar,convert(date, null, 103),101) AS myDate
SELECT convert(varchar,convert(date, '', 103),101) AS myDate
For further details, please see:
CAST and CONVERT (Transact-SQL)[
^]
MS wrote:
When character data that represents only date or only time components is cast to the datetime or smalldatetime data types, the unspecified time component is set to 00:00:00.000, and the unspecified date component is set to 1900-01-01
.