I have two tables with the same column definitions. I need to move (not copy) a row from one table to another. Before I go off and use INSERT INTO/DELETE (in a transaction
You can try Insert into abc (a,b,c) select(a,b,c) from def
doing above so will insert column a, b,c of def into column a,b,c of abc. after inserting run a delete table, drop table or truncate whatever is your criteria.
sample is:
Begin
Begin try
Begin Transaction
Insert into emp(name, department, salary)
Select empName,empDepartment,empSal from employees
Where employees.empID = 211
Truncate table employees
End Transaction
End try
Begin Catch
if @@Error > 0
Rollback Transaction
End Catch
End