Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 between not working

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2008-02-28 : 01:25:43
Hi,
can i anybody help the below query for the o/p

function:date_format(getdate(),'mmm-yy') which will return FEB-08

when iam querying the below statement data is not getting fetching .can anybody correcy it??

select * from
Rev_fbp_posted_dim_tb_tmp2
where dbo.Date_Format(fb_voucher_date,'MMM-YY') between NOV-07' and 'DEC-07'

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-28 : 01:29:07
Why are you comparing STRINGS? You should compare dates.

select *, dbo.Date_Format(fb_voucher_date,'MMM-YY')
from Rev_fbp_posted_dim_tb_tmp2
where fb_voucher_date >= '20071101'
and fb_voucher_date < '20080101'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -