如何用sql语言只获得数据库当前日期,且格式为"yyyy-mm-dd"?

如何用sql语言只获得数据库当前日期,且格式为"yyyy-mm-dd"?
select convert(char(10),getdate(),120)

select * from 表名 where convert(char(10),字段名,120)='2012-01-01'

char(10)为目标数据类型(带有可选的长度)

120为日期/时间的输出格式

参考:

http://www.w3school.com.cn/sql/func_convert.asp

http://blog.csdn.net/jjzaihaozhe/article/details/7173330

你可能感兴趣的:(yyyy-mm-dd,convert())