需要数据库查询以从SQL Server检索日期 [英] Need Database query to retrive Date from SQL server
本文介绍了需要数据库查询以从SQL Server检索日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,
我的表格在(DD/MM/YYYY)中包含出生日期"列,例如(10/09/2011)现在,我要获取07Th月的记录以查找在07Th月出生的用户的信息查询
谢谢与问候
Janareddy.M
Hi Friends,
My table contains "date of birth" column in (DD/MM/YYYY) Like (10/09/2011) Format now i want to get records of 07Th month to find the information of users who Born in 07Th month Can any one send query
Thanks & regards
Janareddy.M
推荐答案
使用DATEPART
参见此处: ^ ]
UseDATEPART
see here : http://msdn.microsoft.com/en-us/library/ms174420.aspx[^]
select * from tablename where DATEPART(mm, datecol) = 7
将月份功能用作
use month function as
select * from tablename where month(dob)='7'
用户MONTH()在您要选择和查询的日期.
User MONTH() on the date you want to select and query.
这篇关于需要数据库查询以从SQL Server检索日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文