Re: Help in writing a trigger



SqlBeginner (SqlBeginner@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
Thanks for your response John. As i said earlier, 95% direct insert
should work as master data would be there. Only rarely (~5%) of time it
would fail. If I validate each and every time I guess the app willl be
slow as I am validating for those 95% records also unnecessarily. Thats
why, instead of validating for this 2 conditions in all records i
thought only when it fails 5% of time i would validate. I would prefer
to test it this way once before taking a call.

The costs for the INSERT SELECT WHERE NOT EXISTS when it does hit any rows
is likely to be small. Given the added complexity you get when you try to
be "smart", I agree with John and say that it is not worth it.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

.



Relevant Pages

  • Re: SQL Injection - Stored Procedures
    ... >> still be 100% protected from SQL injection. ... > You have to realize that alot of the poeple here are not SQL experts. ... So how are you going to protect yourself from SQL ... > and a great way to validate data before it goes into the dB. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Child records with no parent in 10.2.0.3
    ... SQL> CREATE TABLE temp_parent(parent_pk NUMBER NOT NULL, ... SQL> -- Now disable the FK constraint VALIDATE ... SQL> -- Delete from the parent ...
    (comp.databases.oracle.server)
  • Re: Child records with no parent in 10.2.0.3
    ... SQL> CREATE TABLE temp_parent(parent_pk NUMBER NOT NULL, ... SQL> -- Now disable the FK constraint VALIDATE ... Because the constraint constrains the child table and only the child ...
    (comp.databases.oracle.server)
  • Re: SQL Injection - Stored Procedures - Updated
    ... After some considerable testing today on the nature of Stored Procedures and> applying an Injection attack, I've exposed an exploit that isn't from a buffer overflow or a security hole in the SQL Server application itself but more along the lines of taking advantage of SQL and> stored procs. ... Now if you've been paying attention to this thread at all, you'll notice that Dave limits the permissions on the SP's> and I'm sure that some other DBA's follow suit. ... I can use ADODB.Command and NEVER validate any data, and>>>> still be 100% protected from SQL injection. ...
    (microsoft.public.inetserver.asp.general)
  • Re: SQL Injection - Stored Procedures
    ... >> SQL Injection is most easily defeated using regular ... I can use ADODB.Command and NEVER validate any data, ... >be 100% protected from SQL injection. ... >If you are going to validate at all, you must do it on the server. ...
    (microsoft.public.inetserver.asp.general)

Loading