I have two tables in two systems both have the same structure. I want update the data in one table to other
update Table1
set VIEW_CD = cmn.VIEW_CD,
VIEW_DETAIL = cmn.VIEW_DETAIL
FROM dbo.Table1 tbl
INNER JOIN dbo.Table2 cmn ON tbl.id = cmn.id
Both the columns in both the tables are null columns but I am ending up with the exception
Cannot insert the value NULL into column column does not allow nulls. INSERT fails.
I believe the problem is that you have NOT NULL constraint on Table1 , you should drop it :
ALTER TABLE dbo.Table1 ALTER COLUMN VIEW_CD <columnType> NULL
Or this:
ALTER TABLE dbo.Table1 ALTER VIEW_CD DROP NOT NULL
And then run the query once again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With