Contents

System/OS
2003.04.23 11:08

[sql] alter table 쿼리 예제

조회 수 13314 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
자주 안쓰니 까먹지ㅡㅡ;;

Table 수정 관련 쿼리 형식
ALTER TABLE 테이블명 ADD '컬럼명' '컬럼타입';
ALTER TABLE 테이블명 CHANGE '변경할 컬럼명' '새로운 컬럼명' '컬럼 타입';
ALTER TABLE 테이블명 MODIFY '컬럼명' '컬럼 타입';

## MSSQL 에서는.. ##
ms-sqlserver에서 table 또는 필드 속성변경은 alter문을 사용하여 합니다. 

< 필드의 데이타타입 변경 >
alter table table명
alter column 필드명 datatype

ex) test table의 fld필드를 varchar -> int로 변경 
alter table test
alter column fld int

참고) 실제 입력 되어있는 자료중 int형식으로 변경할 수 없는 경우,
(''aaa''값과 같이)에는 sqlserver는 에러를 냅니다. 

< table에 새로운 필드 추가 >
alter table table명
add 필드명 datatype

ex) test table의 fld1을 varchar 데이타타입 8자리로 추가하는 경우 
alter table test 
add fld1 varchar(8)


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
229 Etc 영어. 반드시 외워야 할 문장 패턴 100개 file hooni 2023.06.08 4652
228 Develop [ios] SQLite 사용하기(튜토리얼) + 샘플코드 file hooni 2014.03.28 4622
227 Develop [ios] iOS에서 디바이스 종류 알아오기 hooni 2014.05.24 4605
226 System/OS 네트워크 용어 정리 file hooni 2022.11.20 4598
225 Develop [php][laravel] 라라벨 프로젝트 생성 및 구조 file hooni 2017.12.15 4598
224 Develop [php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축 hooni 2017.12.15 4595
223 Develop [ios] URL 파라미터 파싱~ hooni 2014.05.12 4562
222 Develop macOS에 node, npm 설치하기 (homebrew) file hooni 2021.11.06 4547
221 Develop [ios] UILabel with two different color text hooni 2024.12.14 4529
220 System/OS [macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’ file hooni 2022.06.01 4513
219 Develop [js] jQuery 셀 병합 1 file hooni 2014.09.23 4510
218 System/OS [apache2] Redirect HTTP to HTTPS file hooni 2022.02.03 4489
Board Pagination Prev 1 ... 75 76 77 78 79 80 81 82 83 84 ... 99 Next
/ 99