Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server
i have a table in that there are some columns ,now my problem is i dont want any user to delete column ,please write a trigger such that
no user will not be able to delete the columns in a table ,iam a fresher please help me
Posted 4-Jun-12 3:22am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Here is a Stack Overflow question that has the code you need (in the question):
 
http://stackoverflow.com/questions/1247147/how-to-make-ddl-trigger-for-a-specific-table[^]
 
Basically you create a DDL trigger at the database level that watches the ALTER_TABLE commands. Then, you use the XML EventData to look at which table is being modified and selectively block the action (unless you want to block the modification of every table in your database).
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 510
1 CPallini 330
2 OriginalGriff 225
3 George Jonsson 120
4 ChauhanAjay 104
0 OriginalGriff 6,474
1 Sergey Alexandrovich Kryukov 6,190
2 CPallini 5,180
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 4 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100