首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求救一存储过程解决方案

2012-03-14 
求救一存储过程我现在想写一存储过程,功能是将一张表里的数据取到另外一张表里,条件是循环的取,每次使@sta

求救一存储过程
我现在想写一存储过程,功能是将一张表里的数据取到另外一张表里,
条件是循环的取,每次使@start的分钟加上20,一直到小于等于@end   结束


[解决办法]
create proc up_test1
as
declare @start int
declare @end int
set @start = 0
set @end = 100
while @start <= @end
begin
insert into 表2
select * from 表1
set @start = @start + 20
end
[解决办法]
你怎么写的?
while @start <@end
begin
操作...
set @start=dateadd(minute,20,@start)
end
[解决办法]
每次使@start的分钟加上20,一直到小于等于@end 结束
@start应该是个时间字段

set @start=dateadd(minute,20,@start)

zlp321002(付出最大努力,追求最高成就,享受最佳生活,收获无悔人) 的对.

热点排行