create proc [dbo].[up_tuser_updatepwd]
AS
declare @indextable table(rowid int identity(1,1),nid int)
insert into @indextable(nid) select userID from tuser
declare @uid int
declare laon_cursor cursor for
select nid from @indextable
open laon_cursor
fetch next from laon_cursor
into @ExpertID
while @@fetch_status = 0 --FETCH 语句成功。
begin
declare @randid
int set @randid = 0 while len(@randid)<>6
begin
set @randid =convert(int, substring(convert( CHAR(20),rand()),3, 6)) -- 六位数密码
end
update tuser set upwd =@randid where userID=@uid
FETCH NEXT from laon_cursor
into @uid
end
close laon_cursor
deallocate laon_cursor
go