Click here to Skip to main content
14,113,788 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
how i can avoid this problem:
Cannot insert the value NULL into column 'rowguid', column does not allow nulls. INSERT fails.

sample querry:
insert into tablename (col1,col2,col3)  values('v1','v2','v3')
Posted
Updated 26-Jun-13 18:32pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Check your database schema - rowguid expects a value (as 'allow nulls' is most probably false).
As a result, you get this error.

Since a guid is a unique identifier, you might need to pass a value that is appropriate. I recommend you check your entire code flow to ensure you send in the correct value.
   
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Check you Table design and set allow null........
   
Comments
CDP1802 27-Jun-13 0:58am
   
That's the lazy way out and can lead to more problems than the one it solves. The error may be gone, but what if this value is required and the program's logic does not expect null values and falls on its nose at many places because of that?

The only way to deal with this is to understand your data model. Only then you can make a decision about allowing nulls or not. If not, then the only solution would be to assure that a valid value is provided for this column when rows are inserted.
Nirav Prabtani 27-Jun-13 1:18am
   
Thanks....:)
Nirav Prabtani 27-Jun-13 1:19am
   
I will take care about that...:)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

You can't insert null values if your 'rowguid' column is marked as Primary key.
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190518.1 | Last Updated 27 Jun 2013
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100