Use following script to generate random Passwords
SET @list = 'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789.,-_!$@#%^&*' select replace(SUBSTRING(CONVERT(varchar(255), NEWID()),8, 8),'-','') as RANDOM
Example:
Suppose you have a table tblUser with columns
[id],[userid],[password].
CREATE TABLE [dbo].[tblUser]( [id] [int] IDENTITY(1,1) NOT NULL, [userid] [varchar](250) NULL, [password] [varchar](350) NULL, )
Now Create a trigger on table tblUser and update password column with random password
CREATE TRIGGER [dbo].[insUser] -- SET NOCOUNT ON added to preventextra result sets from
-- interfering with SELECTstatements.
@list varchar
SET @list = 'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789.,-_!$@#%^&*' SET @id = (SELECT max(id) FROM tblUser) UPDATE tblUser set password =replace(SUBSTRING(CONVERT(varchar(255), NEWID()),8, 8),'-','') WHERE id=@id END
this trigger create random password.