34,594
社区成员
发帖
与我相关
我的任务
分享
create table tb4(a int, b int, c int)
select * from tb4
--显示:
a b c
1 1 2 3
2 4 5 6
3 7 8 9
4 7 8 9
if object_id('tb4') is not null
drop table tb4
if object_id('c1') is not null
drop table c1
go
create table tb4
( a int,
b int,
c int
)
insert into tb4 select 1,2,3
union all select 4,5,6
union all select 7,8,9
union all select 7,8,9
go
select * ,identity(int,1,1) d INTO c1 from tb4
update c1 set b=10 where d=4
select a,b,c from c1
Create table tb4(a int, b int, c int)
insert into tb4 select 1,2,3 Union all select 4,5,6 Union all select 7,8,9 Union all select 7,8,9
select * from tb4
alter table tb4 add sid int identity(1,1)
select * from tb4
update tb4 set b=10 where sid=4
alter table tb4 drop column sid
select * from tb4
drop table tb4
alter table tb4 add sid int identity(1,1)
update tb4 set b=10 where sid=4
alter table tb4 drop column sid
update tb4 set b=10 where b=(selet top 1 b from tb4 where b not in (select top 3 b from tb4))