Re: Help in writing a trigger
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Sat, 23 May 2009 05:36:25 -0700
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
.
- Follow-Ups:
- Re: Help in writing a trigger
- From: SqlBeginner
- Re: Help in writing a trigger
- From: SqlBeginner
- Re: Help in writing a trigger
- References:
- Help in writing a trigger
- From: SqlBeginner
- Re: Help in writing a trigger
- From: John Bell
- Re: Help in writing a trigger
- From: SqlBeginner
- Help in writing a trigger
- Prev by Date: Re: Dynamic SQL
- Next by Date: Re: Help in writing a trigger
- Previous by thread: Re: Help in writing a trigger
- Next by thread: Re: Help in writing a trigger
- Index(es):
Relevant Pages
|
Loading