sql server 查询时间 格式化输出

use test
select * from vote
insert into vote (contents) values(GETDATE())
insert into vote (contents,timess,AAA) values ('ss',GETDATE(),GETDATE())
--插入数据时 不能为空值的列名必须 写上, 能为空的可以不写
select AAA from vote where ID=22

select CONVERT(varchar(12) , AAA, 111 ) from vote where ID=22     111的结果 xxxx/xx/xx; 111换成23的结果是 xxxx-xx-xx

 

posted @ 2017-11-23 10:29  enych  阅读(3916)  评论(0编辑  收藏  举报