A Sql Expression about date compare

Posts   
 
    
jimmyxu
User
Posts: 2
Joined: 26-Nov-2009
# Posted on: 26-Nov-2009 11:18:01   

dear professor: I've a question like this: how can i make the expression by llblgen Precidate Expression , according to this sql expressiong?

expression : select * from table where month( date) = month(CONVERT(datetime,'2009-11-26',110)) and day( date) = day(CONVERT(datetime,'2009-11-26',110))

wo just want to select these same month and same day records from a table .

thanks for your reading

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 26-Nov-2009 11:29:11   

select * from table where month( date) = month(CONVERT(datetime,'2009-11-26',110)) and day( date) = day(CONVERT(datetime,'2009-11-26',110))

Easiest thing is to only send the month and day part from the .NET code. i.e. perform the right hand side of the where condition in code. month(CONVERT(datetime,'2009-11-26',110)), can be computed with .NET code Also day(CONVERT(datetime,'2009-11-26',110)) can be computed with .NET code

And the left hand side, month(date) or day(date) can be done by using DBFunctionCalls.

jimmyxu
User
Posts: 2
Joined: 26-Nov-2009
# Posted on: 26-Nov-2009 12:06:27   

thanks, i get it.