2011. 12. 14. 11:16
[MS-SQL] CONVERT를 이용한 날짜 형식 변경
2011. 12. 14. 11:16 in Database / Sql
기준시간 : 2011-12-14 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 1) ' 1' -> 12/14/11
SELECT CONVERT(VARCHAR, GETDATE(), 2) ' 2' -> 11.12.14
SELECT CONVERT(VARCHAR, GETDATE(), 3) ' 3' -> 14/12/11
SELECT CONVERT(VARCHAR, GETDATE(), 4) ' 4' -> 14.12.11
SELECT CONVERT(VARCHAR, GETDATE(), 5) ' 5' -> 14-12-11
SELECT CONVERT(VARCHAR, GETDATE(), 8) ' 8' -> 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 9) ' 9' -> 12 14 2011 1:07:49:520PM
SELECT CONVERT(VARCHAR, GETDATE(), 13) ' 13' -> 14 12 2011 13:07:49:520
SELECT CONVERT(VARCHAR, GETDATE(), 14) ' 14' -> 13:07:49:520
SELECT CONVERT(VARCHAR, GETDATE(), 20) ' 20' -> 2011-12-14 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 21) ' 21' -> 2011-12-14 13:07:49.520
SELECT CONVERT(VARCHAR, GETDATE(), 22) ' 22' -> 12/14/11 1:07:49 PM
SELECT CONVERT(VARCHAR, GETDATE(), 23) ' 23' -> 2011-12-14
SELECT CONVERT(VARCHAR, GETDATE(), 25) ' 25' -> 2011-12-14 13:07:49.520
SELECT CONVERT(VARCHAR, GETDATE(), 101) '101' -> 12/14/2011
SELECT CONVERT(VARCHAR, GETDATE(), 102) '102' -> 2011.12.14
SELECT CONVERT(VARCHAR, GETDATE(), 103) '103' -> 14/12/2011
SELECT CONVERT(VARCHAR, GETDATE(), 104) '104' -> 14.12.2011
SELECT CONVERT(VARCHAR, GETDATE(), 105) '105' -> 14-12-2011
SELECT CONVERT(VARCHAR, GETDATE(), 111) '111' -> 2011/12/14
SELECT CONVERT(VARCHAR, GETDATE(), 112) '112' -> 20111214
SELECT CONVERT(VARCHAR, GETDATE(), 120) '120' -> 2011-12-14 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 121) '121' -> 2011-12-14 13:07:49.520
SELECT CONVERT(VARCHAR, GETDATE(), 1) ' 1' -> 12/14/11
SELECT CONVERT(VARCHAR, GETDATE(), 2) ' 2' -> 11.12.14
SELECT CONVERT(VARCHAR, GETDATE(), 3) ' 3' -> 14/12/11
SELECT CONVERT(VARCHAR, GETDATE(), 4) ' 4' -> 14.12.11
SELECT CONVERT(VARCHAR, GETDATE(), 5) ' 5' -> 14-12-11
SELECT CONVERT(VARCHAR, GETDATE(), 8) ' 8' -> 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 9) ' 9' -> 12 14 2011 1:07:49:520PM
SELECT CONVERT(VARCHAR, GETDATE(), 13) ' 13' -> 14 12 2011 13:07:49:520
SELECT CONVERT(VARCHAR, GETDATE(), 14) ' 14' -> 13:07:49:520
SELECT CONVERT(VARCHAR, GETDATE(), 20) ' 20' -> 2011-12-14 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 21) ' 21' -> 2011-12-14 13:07:49.520
SELECT CONVERT(VARCHAR, GETDATE(), 22) ' 22' -> 12/14/11 1:07:49 PM
SELECT CONVERT(VARCHAR, GETDATE(), 23) ' 23' -> 2011-12-14
SELECT CONVERT(VARCHAR, GETDATE(), 25) ' 25' -> 2011-12-14 13:07:49.520
SELECT CONVERT(VARCHAR, GETDATE(), 101) '101' -> 12/14/2011
SELECT CONVERT(VARCHAR, GETDATE(), 102) '102' -> 2011.12.14
SELECT CONVERT(VARCHAR, GETDATE(), 103) '103' -> 14/12/2011
SELECT CONVERT(VARCHAR, GETDATE(), 104) '104' -> 14.12.2011
SELECT CONVERT(VARCHAR, GETDATE(), 105) '105' -> 14-12-2011
SELECT CONVERT(VARCHAR, GETDATE(), 111) '111' -> 2011/12/14
SELECT CONVERT(VARCHAR, GETDATE(), 112) '112' -> 20111214
SELECT CONVERT(VARCHAR, GETDATE(), 120) '120' -> 2011-12-14 13:07:49
SELECT CONVERT(VARCHAR, GETDATE(), 121) '121' -> 2011-12-14 13:07:49.520
'Database / Sql' 카테고리의 다른 글
[Oracle] 쿼리문 처리 과정 (0) | 2012.02.16 |
---|---|
[Oracle] USER_SOURCE (0) | 2011.12.27 |
[Oracle] 오라클 버전 확인 (0) | 2011.11.16 |
[Oracle] ORA-01476 : 제수가 0 (0) | 2011.11.16 |
[Oracle] RANK() 함수 Sample (0) | 2011.11.15 |