daily-story
[mssql] 테이블 복사
프로그래밍 2011. 5. 12. 11:21

※ 테이블을 생성하면서 데이터도 같이 복사 select * into 생성될테이블명 from 원본테이블명 ※ 구조만 복사 select * into 생성될테이블명 from 원본테이블명 where 1=2 ※ 테이블이 있는경우 데이터만 복사 insert into 카피될 테이블명 select * from 원본테이블명 ※ 특정 데이터만 복사 insert into 카피될 테이블명 select * from 원본테이블명 where 조건

SQL> 테이블만들기, 수정, 삭제
프로그래밍 2008. 3. 24. 14:20

테이블 만들기 ceate table address -- create table 테이블명 ( ID varchar(20) not null, -- ID (컬럼명, 데이터형, null허용여부) Name varchar(20) not null, -- 이름 Email varchar(200) null, -- 이메일 Age int not null, -- 나이 BirthDay datetime not null -- 생일 ) 컬럼 추가하기 alter table address -- alter table 테이블명 add sex char(1) -- add 컬럼명 데이터형 컬럼 삭제하기 alter table address -- alter table 테이블명 drop column sex -- drop column 컬럼명 컬럼 데이터형..