본문 바로가기

DataBase/MSSQL24

[MSSQL] 테이블 형식 확인 When you checking column format. sp_columns [table Name] SELECT * FROM information_schema.columns WHERE table_name = '[table Name]' SQL)sp_columns [table Name] Result) SQL)SELECT * FROM information_schema.columns WHERE table_name = '[table Name]' Result) 2018. 3. 13.
[MSSQL] 데이터에서 enter, tab 제거 데이터 출력시 탭, 엔터, 개행 제거replace Tab, Line feed(LF), Carriage return(CR) Tab(탭) char(9) Line feed(LF, 개행) char(10) Carriage return(CR) char(13) Enter char(10) + char(13) example) SELECT REPLACE(REPLACE(REPLACE('text',char (9), ''), char(10), ''), char(13),'') 2018. 3. 7.
[MSSQL] 프로시져 정보보기 MSSQL프로시져 업데이트 기록 보기 프로시져 업데이트 시 최종 적용 날짜가 궁금할 경우 If you want to check procedure update or modify date, SQL)SELECT ao.name, modify_date as modify, *FROM sys.all_objects aoWHERE ao.type ='P'ORDER BY modify_date DESC Result) 2018. 2. 13.
[MSSQL] 두개 이상 필드 값 비교 ORDER BY [MSSQL] 두개 이상 필드 값 비교 ORDER BY 두개 이상 필드값을 비교하여 정렬 해야할 경우 SELECT seq, addDt, moddt, * FROM [tableName] 각각 ORDER BY를 하면 첫 필드 부터 정렬 됨normal order by sortingSELECT * FROM [tableName] ORDER BY modDt DESC, addDt DESC Example) CASE문으로 조건을 주어 두 필드 이상의 값을 합하여 비교 가능using case with mssql SELECT * FROM [tableName] ORDER BY (CASE WHEN modDt '' Then modDt ELSE addDt END) DESC Example) 2017. 7. 26.