INSERT INTO Locality(versionNo,localityName, localityType, constiCode, deleteFlag,
createdOn, lastUpdate,updatedBy)
SELECT 1, localityName, Localitytype, constituencyCode + '' + regionCode, 1,
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_USER
FROM dbo.MasterTable.
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'localityCode', table 'GovMaster.dbo.Locality';
column does not allow nulls. INSERT fails.
I want to insert but the LocalityCode is primary key and should not be null. But I get that error above. The localityCode is primary key and it can not be null. And i want the localityCode to be auto generated, it should do an autoincrement on insert.