Wednesday, March 25, 2009

T-Sql trigger doesn't always work.

I'm having a rather odd problem.  A trigger I wrote for database Inserts seems to work about 99 percent of the time, but periodically some records will get inserted that the trigger never fires for.  Or rather that the data the trigger is suppose to create is never created.

It's a rather odd delima, if I can figure it out I will try and put the answer here.  In the meantime, if anyone else has experienced this I wouldn't mind hearing about it.

Ok I figured out the answer with a little help from Google.
turns out that in SQL Server a trigger fires once per set of operation as opposed to once per affected row.
so for a standard insert statement the trigger works fine, but if the insert statement has more than one record it is inserting then the trigger will only be fired once.  Good news is that the "inserted" table contains all the records that were inserted, not just one; so you still have access to all the records, you just get them in batch form instead of individually.

Monday, March 2, 2009

Unwanted space between li elements in IE

I ran into an old problem today... a problem where some extra white space was appearing between items in a list.
In this particular case it was only appearing below list elements in an ul where the li contained an image.
Caused the problem:
<ul>
<li><img src="submenu.gif" /></li>
<li>Contact Us</li>
</ul>

Fixed the problem:
<ul>
<li><img src="submenu.gif" />& nbsp;</li>
<li>Contact Us</li>
</ul>

To fix the issue I ended up manually adding a space with the html code & nbsp;
I recall this issue occuring with some floated divs in IE6 as well, though this time I was having the issue with IE7.

It's a really odd fix to a bug in IE7, but it does seem to work and doesn't seem to cause adverse affects in other browsers.