现在我的字段date是char类型。里面的数据如下
2008-2-3
2008-5-10我想用SQL语句把它转换成2008-02-03这种类型的格式。然后再去做比较!
想要的SQL语句是 select date from table where date='2008-02-03' 想让这句话能相等!
2008-2-3
2008-5-10我想用SQL语句把它转换成2008-02-03这种类型的格式。然后再去做比较!
想要的SQL语句是 select date from table where date='2008-02-03' 想让这句话能相等!
这句获得的值还是 2008-9-2 不会添加0
select date from table where datediff(dd,date,'2008-2-3')=0
顺便说下 convert(char(10),date,120) 获取的值 不会在前面加0的!
select date from table where covert(nvarchar(10),date,120)='2008-02-03'