PROBLEM
I have added an extra column (nullable VARCHAR
) to a table in my test environment.
The column displays correctly and can be referenced elsewhere (stored procedures, applications, etc.) but does not seem to accept data from any new rows. The INSERT
statement is successful, but the value for that column is always NULL.
WORKAROUNDS
I am currently using a workaround (insert-then-update), but am curious as to why this is happening in the first place, and would like to get rid of the extraneous operation.
I have tried multiple solutions from similar SO threads (refresh cache, GO, close and reopen, etc.) but haven't had any success.
STEPS TAKEN
Add column to table (Right Click -> Design -> Insert Column -> New nullable
VARCHAR
column). Table isEntryLog
, new column ishostname
GO
Refresh IntelliSense
Try to insert row into table
INSERT INTO EntryLog (employee_id, building_id, hostname) VALUES (012345, 54321, 'TestComputer')
Operations returns success, but the new column is not populated.
Select query for new row shows:
<id>/<employee_id>/<building_id>/NULL
The result should be:
<id>/<employee_id>/<building_id>/<hostname>
Refresh IntelliSense again, check table definition, restart SQL service (just in case)
Try Step 4 again with new values and no success