Swap two string or integer values in SQL
Prateek Diwakar
--For String Declare @F Varchar(20) = 'F' , @S Varchar(20) = 'S'Set @F = CONCAT(@F, @S)Set @S = REPLACE(@F,@S,'') Set @F = REPLACE(@F,@S,'') PRINT(@S) PRINT(@F)--For IntegerDeclare @o int =1 Declare @t int =2Set @o = (@o + @t) Set @t = @o - @t Set @o = @o - @t PRINT(@O) PRINT(@T)