'MSSQL'에 해당되는 글 4건

  1. 2011.06.16 현재시각 리턴

현재시각 리턴


select getdate()
  결과값 : 2011-06-16 16:41:35.393


가공하기
select replace(replace(replace(convert(nvarchar(19), getdate() ,120),'-',''),':',''),' ','')
  결과값 : 20110616164135




반대로 20110616164135을 보기 쉽게 바꿀 때
select substring('20110616164135',1,4)+'-'+
       substring('20110616164135',5,2)+'-'+
       substring('20110616164135',7,2)+' '+
       substring('20110616164135',9,2)+':'+
       substring('20110616164135',11,2)+':'+
       substring('20110616164135',13,2)
  결과값 : 2011-06-16 16:41:35

prev 1 2 3 4 next