
Generate random password as default value
You might consider creating a stored procedure which generates the
password, inserts into (or updates) the table and returns the generated
value to the application as an output parameter or resultset.
Hope this helps.
Dan Guzman
SQL Server MVP
-----------------------
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------
Quote:
> > Hi,
> > I want to set a default value on a column for passwords in a user
table to
> > generate a random string when a row is inserted. The routine to
generate
> the
> > password would be something along the lines of this:
http://groups.google.co.uk/groups?hl=en&selm=u2M9d9xjBHA.2240%40tkmsftng
p02
Quote:
> > using the RAND function.
> > This cannot be used in a User Defined Function since RAND is a
built-in
> > nondeterministic function and not allowed.
> > Could a CREATE DEFAULT do something this complex? Alternatively, can
a
> > default value execute a stored procedure?
> > Thanks.
> Forgot to say, I know I could use a trigger, but that would be less
> convenient when trying to pass back the generated password?
> Also, I've had to revert to ASP to generate the random password to
pass to
> the stored procedure and I'm sure you die-hard SQL fans can't let this
> happen!
> --
> Craig
> D11665 FSB5
> http://www.poxon.org/Craig/Skydive/