Note : All questions are related to SQL Server.
(1) In SQL : How to swap two column values ?
Ans :
update #tempSwap set EMPNAME = DEPT, DEPT = EMPNAME;
NOTE : I used temptable for demo purpose.
Assume I have to perform operation on Employee table then query will be
update Employee set EMPNAME = DEPT, DEPT = EMPNAME;
No comments:
Post a Comment