From time to time I generate the password for new database users, here is the code I use. This works on SQL 2000 and SQL 2005 and SQL Server 2008.
If the user wants a more friendly password I just issue an sp_password to put a more memorable password.
/* To avoid disclosure of passwords, the password is generated in script. */
declare @idx as int
declare @randomPwd as nvarchar(64)
declare @rnd as float
select @idx = 0
select @randomPwd = N''
select @rnd = rand((@@CPU_BUSY % 100) + ((@@IDLE % 100) * 100) +
(DATEPART(ss, GETDATE()) * 10000) + ((cast(DATEPART(ms, GETDATE()) as int) % 100) * 1000000))
while @idx < 64
select @randomPwd = @randomPwd + char((cast((@rnd * 83) as int) + 43))
select @idx = @idx + 1
select @rnd = rand()
SELECT CAST(@randomPwd AS NVARCHAR(8))