>DECLARE tablecursor CURSOR FOR >SELECT pkid FROM mytable > >OPEN tablecursor > >FETCH NEXT FROM tablecursor INTO @pkid > >WHILE @@FETCH_STATUS = 0 >BEGIN > -- Generate your random password > set @randPass = 'abc123' > > -- Update the main table with its new password > update mytable set password = @randPass where pkid = @pkID > > -- Get the next ID > FETCH NEXT FROM tablecursor > INTO @pkid >END > >CLOSE tablecursor >DEALLOCATE tablecursor > >GO > >>