System/OS
2003.04.23 11:08
[sql] alter table 쿼리 예제
Views 13315 Comment 0
자주 안쓰니 까먹지ㅡㅡ;;
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)
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
204 | System/OS | 개인적으로 쓰고 있는 bash_profile | hooni | 2015.01.16 | 2012 |
203 | System/OS | [mac] 패키지 매니저, MacPort | hooni | 2015.01.03 | 2140 |
202 | System/OS | [svn] Can't convert string from native encoding to 'UTF-8' 메시지가 나오는 경우 | hooni | 2014.12.18 | 2196 |
201 | System/OS | [linux] yum 업데이트 시 커널 제외하기 | hooni | 2014.09.11 | 2315 |
200 | System/OS |
[mac] Mac OS 패키지 매니저, HomeBrew
![]() |
hooni | 2015.01.03 | 2549 |
199 | System/OS | [svn] SVN trunk 변경사항 되돌리기 (SVN Rollback) | hooni | 2014.11.27 | 2608 |
198 | System/OS | [svn] 하나의 SVN에서 멀티 저장소 (One svnserve, multiple repositories) | hooni | 2015.01.02 | 2626 |
197 | System/OS | [mac] How to uninstall MySQL on Mac OS. | hooni | 2017.11.08 | 2633 |
196 | System/OS |
[virtualbox] VirtualBox에 Ubuntu 설치하기
![]() |
hooni | 2019.11.22 | 2643 |
195 | System/OS | [mac] Homebrew/rvm/cocoapod setting | hooni | 2017.07.29 | 2648 |
194 | System/OS | [linux] iptables 초간단 세팅 스크립트 | hooni | 2017.09.26 | 2696 |
193 | System/OS | [linux] CentOS 에 APM 설치하기 | hooni | 2015.01.02 | 2977 |