Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Populate password field
Message
From
30/12/2002 16:00:58
John Deupree
Long Term Care Authority
Tulsa, Oklahoma, United States
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00736584
Message ID:
00736750
Views:
8
Thanks for the reply. No I'll only have to run it once in a while, so performance is no problem.

John

>You can always use a cursor, even though they are frowned upon because of performance reasons. But if your not going to run this often it shouldn't matter.
>
>
>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
>
>
>
>
>
>
>
Previous
Reply
Map
View

Click here to load this message in the networking platform