Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Cannot insert NULL into rowguid

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
Hello -
I am using VB6 with a SQL Server 7 database.

When I attempt to ADD a row to the recordset (ex: rsLoadId.Update)...get this error:

btnOpenSpur_Click: 01000: [ODBC SQL Server Driver] The statement has been terminated.
23000: [SQL Server] Cannot insert the value NULL into column 'rowguid', table 'frigdare.dbo.LoadId';
column does not allow nulls. INSERT fails.
Error: 40002=> '01000:[SQL Server] The statement has been terminated' Occurred at line : 100

rsLoadId.AddNew
.
. populate the columns...
.
.


and Line 100 is: rsLoadId.Update (the Error occurs here)

Of course, SQL Server creates and populates the rowguid column; I do not move anything into the rowguid column,
so I am puzzled by this error...

Does anyone know why this would occur ??

Thanks for any ideas.
 
Issue an ALTER statement on the table that you are inserting to to set a DEFAULT of NewID() on the column that requires the GUID, either that or use NewID() in the position of the sql statement that matches the GUID column.

NewID() is the SQL Server function that generates a new GUID.

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top