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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-08-01 : 07:48:04
|
| Mark writes "I am trying to create a procedure that insert a sequencetial or random pin number when a record is inserted to my contact table.Here is the table contactidfirstnamelastnamepin numberAfter the insert has been executed the pun should be created and inserted to the pin number column. One other obastacle is the pin number should not be changed if the record is updated.SparkySQL 2000Windows Advanced Server SP4" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2003-08-01 : 07:59:45
|
| search for RANDOM or IDENTITY or GUID in this site....one, other or all of the topics linked to these keywords would be a step in the right direction for you.stopping the value being changed is seperate matter from getting it there in the 1st place....but a GUID would go someway towards that goal. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-08-01 : 08:09:06
|
| You can DENY update permission on that column:DENY UPDATE (Pin) ON Contact TO PublicAny attempt to update that column will throw an error and cancel the entire update statement. If you want a more graceful handling, you'd have to write a trigger instead of using DENY, and it won't be as secure. |
 |
|
|
|
|
|