开发者

How to check Day & month from date which is in Database table

开发者 https://www.devze.com 2023-01-05 20:14 出处:网络
I have problem here... I want to check Day & month of date which is in database. There is date field is in database which is mm/dd/yyyy format If I use \"select\" query then whole Date is access b

I have problem here... I want to check Day & month of date which is in database. There is date field is in database which is mm/dd/yyyy format If I use "select" query then whole Date is access but I want only these date's which having today's day & month Example: if today's date is 02/02/2010 then select only those date whose day is 02 & month is February.(Dont consider Year)

开发者_Go百科Please be free to ask if you have any problem for understand.


SELECT   *
FROM     {tablename}
WHERE    DAY({datecolumn})=DAY(getdate()) 
AND      MONTH({datecolumn})=MONTH(getdate()) 


I would use DATEPART to pull out the values you're looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消