I have this update that i get have to be sure the user dosn't have another value in a second table and if there is a value it needs to replace the value in the current main table.
SET a.[PERSONNUM] = (select top 1 case
when b.[PERSONNUM] = '' then a.[PERSONNUM]
from [dbo].[hqEmps] b where b.USERACCOUNTNM=a.USERACCOUNTNM order by EMPLOYMENTSTATUS asc)
from [dbo].[cndocemps] a
where a.[HOMELABORACCTDSC] = 'C/-/-/-/-/-/-'
I get this error
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'PERSONNUM', table 'Kronos_CE2.dbo.cndocemps'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
can some one give me a better solution to this i am burned out from racking my brain around this.