'The duplicate key value is (<NULL>, <NULL>) but I don't have that result?
I'm getting the following error when I try to add 3 more columns data to my existing table
> Cannot insert duplicate key row in object 'dbo.table1' with unique
> index 'IX_OL_column1_column2'. The duplicate key value is (<NULL>,
> <NULL>).
Here is my code
INSERT INTO table1 (column3, column4, column5)
select t2.column3, t2.column4, t3.column5
from table1 t1
left join [database1].dbo.table2 t2 on t1.column6 = cast(t2.column6 as nvarchar)
left join [database2].dbo.table3 t3
on t1.column1 = t3.column1 and t1.column2 = t3.column2
where t1.column7 = 0
The thing is, when I run the select command alone while adding column1 and column2 to see the result, there is never a case where the both of them are NULL.
What could be the issue here?
Solution 1:[1]
The solution is:
my syntax is wrong, it should be UPDATE table1 SET
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Saja |
