create database temp_DB
go
use temp_DB
go
--创建两个表
create table t1
( sid nvarchar(50), sname nvarchar(50), type nvarchar(50) )
create table t2
( sid nvarchar(50), sname nvarchar(50), type nvarchar(50) )
go
为一个表t1增加一个字段
alter table t1 Add DrugName Varchar(80) null
为一个表t1删除一个字段
alter table t2 drop column drugname
--插入数据
insert into t1
select '1','芯片' ,'t1',null union
select '2','天' ,'t1',null union
select '3','是的' ,'t1',null union
select '4','鼓励' ,'t1',null union
select '5','谁的' ,'t1',null union
select '6','天天' ,'t1',null
go
insert into t2
select '1',null,null union
select '2',null,null union
select '3',null,null union
select '5',null,null union
select '6',null,null
select * from t1 select * from t2
把一个表中的一个字段的数据插入到另一个表中去
update t2 set t2.sname=t1.sname from t1,t2 where t2.sid=t1.sid