System/OS
2003.04.23 11:08
[sql] alter table 쿼리 예제
조회 수 12613 댓글 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)
-
[ppt] 네오웹 소프트.. 발표 자료 모음
-
[c] 문자열 라이브러리 최신버전
-
[js] 주민번호 생성기..
-
[c] 문자열 컨트롤 함수로 만든 프로그램들..
-
[php] 메모장 - 웅지학원 ([c] mysql 백업프로그램 포함)
-
[linux] root도 삭제하지 못하는 파일 속성
-
[linux] 터미널에서 문자 깨질 때 설정 ㅋㅋ
-
[mysql] error while loading shared libraries: libmysqlclient.so.10:
-
[dos] 노트북 백업 스크립트 xcopy 명령 예제
-
[js] 가운데 새창 뜨는 함수와 이벤트
-
[algorithm] Greedy (탐욕 기법)
-
[sql] alter table 쿼리 예제