I made a system to insert data from one table to another using run button, So if these data is exisitng it show error message like this:
"
SQLState: 23000 Error Code: 2601 Message: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cannot insert duplicate key row in object ‘dbo.Emp_Accommodate’ with unique index ‘IX_Emp_Accommodate’. The duplicate key value is (100146). SQLState: 01000 Error Code: 3621 Message: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]The statement has been terminated.
INSERT INTO Emp_Accommodate (EmployeeNo, NameAr, Nationality_Ar, JobActual_Name, Project_Name, IqamaID_No, PassportNo, TelNo, Shift_Type, Room_IDF, House_IDF) SELECT EmployeeNo, NameAr, Nationality_Ar, JobActual_Name, Project_Name, IqamaID_No, PassportNo, TelNo, Shift_Type, Room_IDF, House_IDF FROM Employee WHERE EmployeeNo "
What I want is either a small message to appear instead of the previous one,
Or, the data is updated if there is duplicate in the data?
Kind regards