Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
matrixrep
Starting Member
30 Posts |
Posted - 2012-11-07 : 13:55:55
|
I have a stored procedure that generate a password the way i want.I want to update the field password in a table containing 3 columns (userID, name, password)What is the best way to put a different password for each userid ? |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-11-07 : 14:09:21
|
Easier if you can make the query in-line, or convert it into a function rather than a stored proc. If you were to convert it to a function, then you can do something like shown below:UPDATE y SET y.Password = f.PasswordFROM YourTable y CROSS APPLY dbo.YourFunction(userId,[name]) f |
|
|
matrixrep
Starting Member
30 Posts |
Posted - 2012-11-07 : 14:33:15
|
I need to use my stored procedure. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-11-07 : 15:31:39
|
Could you make your stored procedure a function? A function is more appropriate for this task.JimEveryday I learn something that somebody else already knew |
|
|
matrixrep
Starting Member
30 Posts |
Posted - 2012-11-08 : 09:10:04
|
I cannot use a function. My stored procedure generate only a random password. |
|
|
matrixrep
Starting Member
30 Posts |
Posted - 2012-11-08 : 09:37:35
|
Thanks for your help Declare @Password nvarcharUPDATE MyTABLE SET Password = dbo.Myfunction(@Password) WHERE ...That did the trick for me. |
|
|
|
|
|