sql存储过程循环while
来源:动视网
责编:小采
时间:2020-11-09 10:01:46
sql存储过程循环while
sql存储过程循环while:create procedure [拥有者.]名[;程序编号] [(参数#1,…参数#1024)] [with {recompile | encryption | recompile, encryption} ] [for replication] as 程序行 其中存储过程名不能超过128个字。每个存储过程中最多设定1024个参数
导读sql存储过程循环while:create procedure [拥有者.]名[;程序编号] [(参数#1,…参数#1024)] [with {recompile | encryption | recompile, encryption} ] [for replication] as 程序行 其中存储过程名不能超过128个字。每个存储过程中最多设定1024个参数

用游标吧
declare @a int,@b int
declare ccc cursor for select * from test where id>@id
open ccc
fetch next from ccc into @a,@b
while (@@fetch_status=0)
begin
.......
end
close ccc
declare ccc(这个操作看看别的系统存储过程怎么写的 记不太清了 每次都是copy的)
大概就是这样 不知道语法有没有错误 最近一段时间没用sqlserver了 看看系统存储过程就能明白怎么用cursor了
sql存储过程循环while
sql存储过程循环while:create procedure [拥有者.]名[;程序编号] [(参数#1,…参数#1024)] [with {recompile | encryption | recompile, encryption} ] [for replication] as 程序行 其中存储过程名不能超过128个字。每个存储过程中最多设定1024个参数