如果姓名不重复create table a ( name varchar(10),age int )
insert into a
select 'Michael' ,20
union all
select 'John' ,23
union all
select 'Mary' ,24select * into b from adeclare @i int
select @i=count(1) from b
while @i>0
begin
select top 1 * from b
delete b
where name in (select top 1 name from b)
set @i=@i-1
endname age
---------- -----------
Michael 20(所影响的行数为 1 行)
(所影响的行数为 1 行)name age
---------- -----------
John 23(所影响的行数为 1 行)
(所影响的行数为 1 行)name age
---------- -----------
Mary 24(所影响的行数为 1 行)
(所影响的行数为 1 行)
insert into a
select 'Michael' ,20
union all
select 'John' ,23
union all
select 'Mary' ,24select * into b from adeclare @i int
select @i=count(1) from b
while @i>0
begin
select top 1 * from b
delete b
where name in (select top 1 name from b)
set @i=@i-1
endname age
---------- -----------
Michael 20(所影响的行数为 1 行)
(所影响的行数为 1 行)name age
---------- -----------
John 23(所影响的行数为 1 行)
(所影响的行数为 1 行)name age
---------- -----------
Mary 24(所影响的行数为 1 行)
(所影响的行数为 1 行)
create table 表1(name varchar(10),age int)
insert into 表1 select 'Michael',20
insert into 表1 select 'John ',23
insert into 表1 select 'Mary ',24
GO--借助含自增列的表变量实现循环处理过程
declare @t table(id int identity(1,1),name varchar(10),age int)
declare @i int,@name varchar(10),@age int
set @i = 1insert into @t select * from 表1select @name=name,@age=age from @t where id=@i
while @@rowcount<>0
begin
print 'name='+@name+';age='+rtrim(@age)
set @i=@i+1
select @name=name,@age=age from @t where id=@i
end
go/*
name=Michael;age=20
name=John ;age=23
name=Mary ;age=24
*/--删除测试数据
drop table 表1
1、需求变更
这个时候肯定要做补充合同 来说明 功能变更以及工期的问题
2、设计不合理,那就是自己的责任了
这个就难说了 如果客户同意 可做补充合同
客户一定要按原合同执行 那你就承担责任吧