Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Filtering DML Statements


Filtering DML Statements

Author
Message
Shaunt_Kolf
Shaunt_Kolf
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 165
Comments posted to this topic are about the item Filtering DML Statements
Dan Mabee
Dan Mabee
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 122
the column filtering solution is incomplete. consider this update statement:

update tableA set name ='Jane',contactnumber='baddata' where id=8


since column(name) comes up true, it still executes. column() doesn't mean only that column, just that it has to be included.

here's some logic i've used to make sure that the number of columns matches what i want:

   declare @mc int
   set @mc=0
   declare @cu int
   set @cu=columns_updated()
   while @cu>0
   begin
      if (@cu & 1)>0
      begin
         set @mc=@mc+1
         set @cu=@cu-1
      end
      set @cu=@cu/2
   end
   if @mc=1 and update(name)
noeld
noeld
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6320 Visits: 2048
Although the article shows a simple technique there are many things that were omitted.

This is NOT a way to handle such things if there are strict requirements from security standpoint.
1. You could potentially read the record, delete it and insert it back again with the changes you want.
The update trigger will never KnowSad
2. Workstation_id and application_name are values "settable" on the connection string and can be manipulated.
3. To Rollback in a trigger is a very expensive proposition for a busy system.
4. This kind of control should be performed using other security mechanisms.

All in all the article shows "a way" to do it I just wanted to point out that this is by no means THE way of doing such things if strict requirements are needed.


* Noel
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search