SQL Server - explanation

Asked By ali shaik on 05-Mar-12 02:37 AM
hi,,,,,
 
         plz give me the explanation for the below code





CONVERT(date, '01-' + Convert(varchar(2),BF.[Month]) + '-' + Convert(varchar(4),BF.[Year])) between CONVERT(date, '01-' + Convert(varchar(2),@FromMonth) + '-' + Convert(varchar(4),@FromYear)) and CONVERT(date, '01-' + Convert(varchar(2),@ToMonth) + '-' + Convert(varchar(4),@ToYear))
kalpana aparnathi replied to ali shaik on 05-Mar-12 03:32 AM
hi,

CONVERT(date, '01-' + Convert(varchar(2),BF.[Month]) + '-' + Convert(varchar(4),BF.[Year])) between CONVERT(date, '01-' + Convert(varchar(2),@FromMonth) + '-' + Convert(varchar(4),@FromYear)) and CONVERT(date, '01-' + Convert(varchar(2),@ToMonth) + '-' + Convert(varchar(4),@ToYear))

This code is look like for converting date with the range of date like first day of month from user entered month and year to user entered month and year and casting date of first day of this range .

Regards,