title: C++: How to set GUID to NULL instead of GUID_NULL?
body: <p>I have a database which uses GUIDs instead of, say, an ordinary counter for the ID fields. But I can't seem to put NULL (instead of GUID_NULL) into such fields in DB even though. Yes, the field in the database does take NULL.</p>
  
  <p>Let's say there is a parent-child relationship between two tables. So there is a parent and a child GUID references from one table to another. But the "root" parent does not have any parent and there I would like to be able to put NULL into its ParentUID database field. If I put GUID_NULL there then I will need a corresponding default row in the referenced table which has a GUID-value of GUID_NULL so that the foreign key constraint won't break.</p>
  
  <p>Also, using GUID_NULL with default-rows at referenced tables will give me a resultset back when doing a standard join operation...which is not desirable.</p>
  
  <p>They way it's done in code when inserting values into database is using a CCommand which takes structure that contains the values of the row fields to be inserted. One of these is a GUID type variable.</p>
  
  <p>So it creates an SQL statement string looking like </p>
  
  <pre><code>INSERT INTO [tablename] (field1, field2, field3,...) VALUES(?,?,?,...)
  </code></pre>
  
  <p>and then in a loop there is something like:</p>
  
  <pre><code>command.field1 = 1;
  command.field2 = 2;
  command.GUIDField = ?????? //I want to put NULL here instead of GUID_NULL
  
  command.Open(...); 
  </code></pre>
  
  <p>I hope it is understandable what I wish to do and what the conditions in code are.
  Thankful for help!</p>
  
  <p>UPDATE:
  Ok, it was very hard to exaplin correctly, but this is exactly what I want to do <a href="http://support.microsoft.com/kb/260900" rel="nofollow">http://support.microsoft.com/kb/260900</a><br>
  Just that when I follow that example, it makes no difference...still I get FK constraint violation on insert so I suspect it is trying to insert GUID_NULL instead of NULL. :(</p>