How to Swap Column Values in SQL Server

In this article, we will show you how to write a SQL Query to Swap Column Values in SQL Server with example. For this SQL Interview Question, We are going to use the below-shown data

How to Swap Column Values in SQL Server 1

How to Swap Column Values in SQL Server?

Please use the below-shown frequent query to swap two column values

-- Query to Swap Two Column Values in SQL Server
USE [SQL Tutorial]
GO

UPDATE [dbo].[EmployeeDuplicates]
	SET [Education] = [Occupation],
	    [Occupation] = [Education]
GO

Run the above swap sql columns query

Messages
--------
(14 row(s) affected)

Let me show you the updated SQL Server records. From the below screenshot, you can see that the information in the Education column stored in Occupation Column. And data inside the Occupation column is stored in the Education column.

How to Swap Column Values in SQL Server 3