RSS

Monthly Archives: July 2013

SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 3 of 31

 

SQL SERVER – 2008 – Introduction to Table-Valued Parameters with Example

 
Leave a comment

Posted by on July 6, 2013 in SQL

 

Swap Value Between Two Row Of Columns In MS-SQL

Swap Value Between Two Row Of Columns In MS-SQL

Following Code Will Help you to Swap Value Between Two Row Of Columns In MS-SQL

 begin tran

declare @sum int

select @sum = sum(DisplaySeq)
from CustomCatalogForm
where CustomCatalogFormId in (1,2)

update CustomCatalogForm
set DisplaySeq = @sum - DisplaySeq
where CustomCatalogFormId in (1,2)

commit tran

I hope this helps, good luck!

 

Tags: , , ,