SQL 字符串类型的日期取值时补零

 1 select mydate from tb
 2 --结果
 3 mydate
 4 2008-4-9  
 5 2008-5-30 
 6 2008-3-7  
 7 2008-3-19 
 8  
 9 select convert(varchar(10),cast(mydate as datetime),120) as mydate from tb
10  
11 --结果
12 mydate
13 2008-04-09
14 2008-05-30
15 2008-03-07
16 2008-03-19

 

posted @ 2013-08-08 10:58  ^懒洋洋^  阅读(1023)  评论(0编辑  收藏  举报