IT/DATABASE

MSSQL- Alter Table Column

솜주먹 2019. 8. 29. 13:03

1. 필드 추가하기

alter table [테이블명] add [칼럼명] [형식] [기타 제약 조건]

ex)

alter table user_mstr add user_pw_old varchar(100) not null;

 

2. 테이블 필드 수정하기

alter table [테이블명] alter column [칼럼명] [형식] [기타 제약 조건]

ex) alter table tbl_shopinfo alter column shopname varchar(200) not null


3. 필드 삭제 하기

alter table [테이블명] drop column [칼럼명];

ex) alter table tbl_shopinfo drop column shopname


4.컬럼 전체조회

select * from sys.columns where object_id =object_id('account_cow_mast')