Generate random password as default value 
Author Message
 Generate random password as default value

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://www.***.com/ %40tkmsf...
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.

--
Craig
D11665 FSB5
http://www.***.com/



Sun, 03 Oct 2004 18:25:23 GMT
 Generate random password as default value


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%40tkmsf...

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/



Sun, 03 Oct 2004 19:04:07 GMT
 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/



Sun, 03 Oct 2004 19:47:05 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. HOWTO: Generate Random Column ID as the Default

2. Generating Random Passwords

3. Generating random passwords

4. Generating Random Passwords

5. Generating Random Passwords

6. An SPL routine to generate random password.

7. An SPL routine to generate a random password

8. Stored Procedure not generating random values

9. Generate scripts does not preserve Default values.

10. Script generated by Enterprise manager does not have default values

11. What is the default password for the postgres user in the default

12. Stored Procedure Defaults (Can I use functions to get the default value)


 
Powered by phpBB® Forum Software