I am trying to run an INSERT SELECT FROM statement that fails with the error "Cannot insert the value NULL into column CarrierID" but when I run just the SELECT statement part of the INSERT no null values are returned so I am not sure why a null is being picked up. I do know the source table does have two rows where the Carrier_SCAC is '' but it is not null and the WHERE clause should be, and is, filtering out those two rows. INSERT INTO dbo.Driver ( CarrierID, Name, Locked, DateLocked, Memo, UniqueIdentifier, CreatedByUserId, CreatedDate ) SELECT (SELECT Id FROM RTS.dbo.Carrier WHERE Carrier.SCAC = RemoteTerminals.dbo.Driver.Carrier_SCAC), Driver_Name, COALESCE(Driver_Locked, 0), Driver_Locked_Date, Driver_Locked_Memo, NEWID(), 0, GETDATE() FROM RemoteTerminals.dbo.Driver WHERE RemoteTerminals.dbo.Driver.Carrier_SCAC <> '';
-- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia