SQL Server 查询当天记录

select top 10 * from test where day(dateandtime)=day(getdate())


select * from test  where datediff(d,day(dateandtime),day(getdate()))=0

 

select   *   from   Attendance   where   convert(char(10),time,111)=convert(char(10),getdate(),111)

 

 

查询某一天的记录

 

SELECT *  FROM table where convert(char(10),createdTime,120)= '2011-05-20 '

 

 

 

你可能感兴趣的:(sql,server)