<<< 返回 access911.net 编程静态资料库索引页 如何去掉sqlserver日期字段中的时间? 作者: 摘自: 录入:cg1 时间:2003-9-12 浏览人次:706
专题地址:http://access911.net/index.asp?u1=a&u2=78FAB11E11DC 如果需要更详细的评论或说明,请点击该地址。 简述: 问题:
| sqlserver中日期字段包括时间,如何去掉? 我要判断某条记录是否是今天的,用 | select * from table where datefield=getdate() |
字段中的日期为 2003-01-01 12:00:00 ,查询出来的结果却不包括这条记录?怎么办? |
回答:
| select CONVERT(varchar(10), getDate(),120) --不要时间2002-1-1 select convert(char(8),getdate(),112) ----20020101 select convert(char(8),getdate(),108) ---06:05:05 |
101 美国 mm/dd/yyyy 2 102 ANSI yy.mm.dd 3 103 英国/法国 dd/mm/yy 4 104 德国 dd.mm.yy 5 105 意大利 dd-mm-yy 6 106 - dd mon y..................... ........... |
|