Thu
19
Oct '06
If you want to build a DateTime from values… suppose you have columns in your table, say fyear and fmonth and you want to make a DateTime value for doing some checkings….
Eg:
convert(datetime,cast([fmonth] AS varchar(2))+‘-01-’+cast([fyear] AS varchar(4)))
Eg:
SELECT *
FROM pamodea
WHERE convert(datetime,cast([fmonth] AS varchar(2))+‘-01-’+cast([fyear] AS varchar(4))) BETWEEN @startdate AND @enddate

Leave a passing comment »