hrming
[DB/SQL] CONVERT 본문
CONVERT(VARCHAR, GETDATE(), 112)
SQL문을 보다가 CONVERT문을 처음으로 봤다.. 뭔가를 변경하겠구나 싶긴했는데 저 뒤에있는 112는 뭔지..아리송..
구글링하다가 아래 사이트에서 관련 정보를 찾았다.
The CONVERT function converts values from one data type to another.
The format of the converted data type may also be specified.
If the conversion fails, an error is returned.
CONVERT (data_type(length), expression, style)
data_type -- data type the expression must be converted to.
length -- optional, the length of the result data type.
expression -- the value to be converted.
style -- optional, a format to be used to the result.
맨 마지막에 있는 숫자 112는 Convert할 Date and Time style이었다.
112 | ISO | yyyymmdd |
https://www.dofactory.com/sql/convert
SQL CONVERT Function - Dofactory
Earn income with your data and sql skills Sign up and we'll send you the best freelance opportunities straight to your inbox. We're building the largest self-service freelancing marketplace for people like you.
www.dofactory.com
+ 2023/01/03 실제로 사용!
SELECT CONVERT(varchar(10), B.BRTH_DT, 103),
'DB' 카테고리의 다른 글
[DB/SQL] Foreign Key (외래키) (2) | 2024.03.14 |
---|---|
[DB/SQL] INNER JOIN / OUTER JOIN / LEFT OUTER JOIN (0) | 2023.02.09 |
[DB/Hibernate] @TableGenerator (0) | 2022.11.16 |
[DB/MyBatis] #{} 와 ${} 개념과 차이점 (0) | 2022.05.19 |
[DB/MyBatis] 관련 오류(예외)시 꼭! 확인해야 될 사항 (0) | 2022.05.19 |