Inserting UniqueIdentifier results in null value

So I have this table with a bunch of nullable fields. Amoung them is a uniqueIdentifier column(FK_ID)  that is also nullable. I also have an ID field(TableA_ID) which gets set by NewID() as the default value. I do an insert like so....

INSERT INTO [TableA](FK_ID)
SELECT NewID()
(1 row(s) affected)

I see the following result in TableA
FK_ID____________________________TableA_ID____________________________
Null                                                                      9326DC68-2303-4A12-B2CB-6458E215DFD4

Why can't I insert a uniqueidentifier?
rlstewartAsked:
Who is Participating?
 
rlstewartConnect With a Mentor Author Commented:
Found the problem, there was a INSTEAD OF INSERT trigger that had left off the FK_ID column, hence the null value. DOH!!!!
0
 
chapmandewCommented:
so, fk_id doesn't have a value in it?  
0
 
rlstewartAuthor Commented:
A new row is added with the value null in the FK_ID field.
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
chapmandewCommented:
are you sure the field tablea_id has a default value of newid()??
0
 
Kevin CrossChief Technology OfficerCommented:
Is there a constraint on FK_ID that it must be NULL or a valid value from another table?
0
 
tigin44Commented:
is the table trying to insert value a detail table? if so then you should insert the value for the master table. and then insert into the detail table.
0
All Courses

From novice to tech pro — start learning today.