go
declare @auid uniqueidentifier,@name varchar(Max) ---定义变量
declare auth_cur cursor for --定义游标
select ID, [FirstMenu] from [dbo].[MenuList]
open auth_cur--打开游标
fetch next from auth_cur into @auid,@name--变量与查找的字段对应
while (@@fetch_status=0)
begin
print @auid---------------------------------------------------------------------------------------------
print ‘名称: ‘+@name
insert into MenuFeature values(NEWID(),‘可读‘,2,@auid,0)--获取循环每条数据擦操作
insert into MenuFeature values(NEWID(),‘可写‘,3,@auid,0)------------------------------
fetch next from auth_cur into @auid,@name--重新初始化变量的值
end
close auth_cur
deallocate auth_cur
go
时间: 2024-10-03 22:38:33