You are here: Re: Trigger Error « MsSQL Server « IT news, forums, messages
Re: Trigger Error

Posted by Erland Sommarskog on 05/27/05 23:56

Hugo Kornelis (hugo@pe_NO_rFact.in_SPAM_fo) writes:
> I stick to my advice: remove the derived column, and use a user-defined
> function to calculate the depth when you retrieve data.

Permit me to bump in and say that this is a trade-off on where you want
to take the performance penalty. However, a computed column would have
to traverse the tree from to bottom each time, whereas the trigger only
needs to access the parent level.

SELECT * FROM tbl

with a UDF call for tree-traversal for each row is likely to perform
poorly.

So my vote goes for the column. I think I would go for it, if would
have reasons to move around things in the tree, although it would be
bit hairly to maintain this column,

> it will work fone, even for multi-row inserts, as long as you never
> insert both a parent and a child in the same statement

Hey, the primary key is an IDENTITY column, so he can't do that!



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация