I have a table with a computed primary key where I'm trying to insert a row but I'm getting this error:
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'PriKey', table 'SuesTbls.dbo.testvendor'; column does not allow nulls. INSERT fails.
The statement has been terminated.
The PriKey consists of two columns, one is the auto generated numeric and the other is another column on the table.
Here's my query:
insert into[dbo].[testvendor](state,county,fips)values('VA','HANOVER','51085')
I also tried this query:
insert into [dbo].[testvendor](state,county,fips) select state,county,fips from anothertbl
from wherenotexists(selectnullfrom[testvendor]where[testvendor].fips=[CSC DEED TABLE].fips
and[testvendor].rec_date_from=[CSC DEED TABLE].rec_date_from)
Both queries resulted in the same error.
Do I need to add anything other stuff to my insert statement?
Please help.
Ming A.