How to swap the data of two columns in a table. both the
columns containing varchar values.

Answer Posted / ami tkumar

Sorry for previous answer.

DECLARE @temp AS varchar(50)
UPDATE swapdata SET @temp=value2,value2=value1,value1=@temp

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what is the significance of null value and why should we avoid permitting null values?

545


Does index slows down insert statements?

584


How do triggers work?

534


Explain an incremental backup?

585


What structure can you implement for the database to speed up table reads?

704






What is sql server profiler?

565


What is the use of set nocount on/off statement?

622


How do you clear a log file?

507


What is difference between after and before?

498


Explain in brief how sql server enhances scalability of the database system?

475


explain extended properties

560


What is meant by dirty read?

550


How do I start sql server?

528


Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?

575


Write a sql query to get zero records from a table having n number of records?

705