Build DateTime from values
Filed in C# on Oct.19, 2006
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….
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
Related posts:























Leave a Reply
You must be logged in to post a comment.