Contents

System/OS
2003.04.23 11:08

[sql] alter table 쿼리 예제

조회 수 12518 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
154 System/OS [linux] yum 업데이트 시 커널 제외하기 hooni 2014.09.11 1402
153 System/OS [linux] resolv.con 초기화 되는 문제 hooni 2014.04.05 4691
152 System/OS [linux] CentOS 6.5 에서 "Bringing up interface eth0: Determining if ip address 121.78.127.197 is already in use for device eth0..." hooni 2014.04.05 4959
151 System/OS [mac] 맥(OSX)에서 NTFS, 윈도우에서 HFS+ 사용하기 file hooni 2014.03.12 5177
150 System/OS [mac] 맥OSX에서 NTFS 쓰기 기능 활성화 hooni 2014.03.12 4358
149 System/OS HTTPS와 SSL 인증서 file hooni 2014.03.11 7628
148 System/OS [linux] split 명령어 hooni 2014.03.11 4374
147 System/OS [linux] awk 명령어 hooni 2014.03.11 5031
146 System/OS [linux] 쉘스크립트 expr hooni 2014.03.11 15701
145 System/OS [linux] CentOS Apache Httpd에 https 적용 hooni 2014.03.05 4577
144 System/OS [linux] CentOS 6.x Cati 설치 (yum) hooni 2014.01.17 48658
143 System/OS [linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기 file hooni 2014.01.09 12284
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 17 Next
/ 17