개발관련/SQL

SQL :: Substring

guuuuuuu 2016. 8. 5. 11:16

문자열 변형. 



기본형태 : substring(대상문자, 시작Index, 읽어들일 Length)


test

yyyymmddyyyymmdd

yyyymmddyyyymmdd

yy

yyyym


test라는 열에 위와 같은 data가 있을때, 


select test, substring(test, 5, 2), substring(test,7,2) from table_name


substring(test,5,2)        substring(test, 7, 2)

mm                            dd

mm                            dd

-                                -

m                              -


이처럼 부분적으로 문자열을 추출한다.