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 |
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-02-13 : 17:14:07
|
hi there i have a tablewith 4 columns idclient name lastname id i have an aplication where i can modify the 3 columns (name, lastname and id) and update the table, that i want to do is that the column "id" will never be updated , doesnt matter if in my asp application i change the value of the column idexample ,in my table i have this recordidclient name lastname id156 peter fox 323265 that i want is ,,,, if my mates change the value of the id,, raise an error saying cannot update idor something like that |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-13 : 18:15:49
|
you can create a trigger on table to avoid updatesfor update it will be likwupdate tableset name= @name, lastname = @Lastnamewhere idclient = @idclient ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-02-13 : 18:18:44
|
Depending on your scenario, you might need to implement a (before) trigger on the table. But, perhaps there are other ways to solve the issue, like a foreign key constraint? But, given the information you provided, a trigger looks to solve that problem. |
 |
|
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-02-14 : 07:10:57
|
hi visakh16thanks for always answer my threads,and thanks Lampreycould you give me an example with my caseor a similar one,,,i dont know too much about triggersthanks in advanced |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-14 : 09:52:25
|
quote: Originally posted by sebastian11c hi visakh16thanks for always answer my threads,and thanks Lampreycould you give me an example with my caseor a similar one,,,i dont know too much about triggersthanks in advanced
i've given a sample trigger stub herehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=171322------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|