[mssql] 테이블 생성

dhjo ㅣ 2021. 2. 15. 17:12

테이블 생성하기


생성법 )

create table 테이블명 ( 컬럼명 타입 형태 )


쿼리문)

begin tran

create table testTable(
idx int identity(1,1) NOT NULL,
id varchar(50),
name varchar (50) NOT NULL,
title varchar (2000) NOT NULL,
value varchar NOT NULL
)

--rollback
--commit
  • begin tran을 걸어주어 잘못생성했을경우를 대비하여준다.
  • begin tran을 실행한 후 에는 항상 rollback또는 commit을 해줘야한다.

alter table 을 통하여 테이블을 변경할수 있다.

delete table 을 통하여 테이블을 삭제할수 있다.

'DataBase > mssql' 카테고리의 다른 글

[mssql] Clustered(클러스터), NonClustered(넌 클러스터)  (0) 2021.02.26
[mssql] Cursor  (0) 2021.02.16
[mssql] set, nocount  (0) 2021.02.11
[mssql] case, when  (0) 2021.02.11
[mssql] isnull  (0) 2021.02.11