I posted earlier about my nasty experiences with site column deployment. This time I was working with eventhandlers and had interesting error message that I thought I'd share to you. I had created a pretty simple eventhandler and it was working fine. But then I needed to make few modifications and needed to deploy my eventhandler again. And then I saw following error message:

stsadm -o activatefeature 
-filename MyWeirdEventHandler\feature.xml
-url http://server/MyWeirdSite Cannot insert the value NULL into column 'Name',
table 'WSS_Content_Portal.dbo.EventReceivers';
column does not allow nulls. INSERT fails. The statement has been terminated.

But this time I was smart enough to check changes in my EventHandler.xml file. And I noticed that I have commented Receivers as seen below:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Document library -->
  <!--		   
    <Receivers ListTemplateId="101" >
     <Receiver>
      <Name>My eventhandler</Name>
      <Class>MyEventHandler.DocumentLibraryHandler</Class>
      <Assembly>MyEventHandler, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=c68c273ce9d7cee3</Assembly> <SequenceNumber>1000</SequenceNumber> <Type>ItemDeleting</Type> </Receiver> </Receivers> --> <!-- Forms library --> <Receivers ListTemplateId="115"> <Receiver> <Name>My eventhandler</Name> <Class>MyEventHandler.DocumentLibraryHandler</Class> <Assembly>MyEventHandler, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=c68c273ce9d7cee3</Assembly> <SequenceNumber>1000</SequenceNumber> <Type>ItemAdding</Type> </Receiver> </Receivers> </Elements>

So somehow commenting that first section caused the feature activation to fail. I don't know why that happens but it's still good to know the reason for that error message. I hope this helps someone who has that error message and doesn't know what to do.

Anyways... happy hacking!

J