Ugly hack

set nocount on
declare @a int
declare @b varchar(128)
set @a=0
drop table #rp
create table #rp(p varchar(128))
While 1=1
set @a=(Select Min(theindexfield) from thetable Where theindexfield>@a)
If @a is null
delete from #rp
insert into #rp exec random_password 8,'simple'
update thetable set thepassfield=(select p from #rp) where id=@a

the random_password procedure is something found on the ‘Net, thanks to the dude who wrote it. Full listing below:

CREATE PROC random_password
@len int = 8, --Length of the password to be generated
@password_type char(7) = 'simple'
--Default is to generate a simple password with lowecase letters.
--Pass anything other than 'simple' to generate a complex password.
--The complex password includes numbers, special characters, upper case and lower case letters
Copyright © 2001 Narayana Vyas Kondreddi. All rights reserved.

Purpose:	To generate a random password

Written by:	Narayana Vyas Kondreddi
<a href="" target="_blank"></a>

Tested on: 	SQL Server 7.0 and SQL Server 2000

Date modified:	March-29-2001 01:15 PM

Email: 		<a href="" target="_blank"></a>


To generate a simple password with a length of 8 characters:
EXEC random_password

To generate a simple password with 6 characters:
EXEC random_password 6

To generate a complex password with 8 characters:
EXEC random_password @Password_type = 'complex'

To generate a comples password with 6 characters:
EXEC random_password 6, 'complex'
DECLARE @password varchar(25), @type tinyint, @bitmap char(6)
SET @password=''
SET @bitmap = 'uaeioy'
--@bitmap  contains all the vowels, which are a, e, i, o, u and y. These vowels  are used to generate slightly readable/rememberable simple passwords

WHILE @len &gt; 0
IF @password_type = 'simple' --Generating a simple password
IF (@len%2) = 0  --Appending a random vowel to @password

SET @password = @password + SUBSTRING(@bitmap,CONVERT(int,ROUND(1 + (RAND() * (5)),0)),1)
ELSE --Appending a random alphabet
SET @password = @password + CHAR(ROUND(97 + (RAND() * (25)),0))

ELSE --Generating a complex password
SET @type = ROUND(1 + (RAND() * (3)),0)

IF @type = 1 --Appending a random lower case alphabet to @password
SET @password = @password + CHAR(ROUND(97 + (RAND() * (25)),0))
ELSE IF @type = 2 --Appending a random upper case alphabet to @password
SET @password = @password + CHAR(ROUND(65 + (RAND() * (25)),0))
ELSE IF @type = 3 --Appending a random number between 0 and 9 to @password
SET @password = @password + CHAR(ROUND(48 + (RAND() * (9)),0))
ELSE IF @type = 4 --Appending a random special character to @password
SET @password = @password + CHAR(ROUND(33 + (RAND() * (13)),0))

SET @len = @len - 1

SELECT @password --Here's the result