Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

there are 2 variables called x and y ,x contains 1,2 and y
contains 3,4 we have to swap the values from x to y and y
to x with out using dummy variables and it can be done only
by using a single statement ? how?

Answer Posted / raji_4u

IF YOU WANT TO UPDATE THE TABLE,

UPDATE TABLE_NAME
SET X = Y, Y = X;

--------------------------
IF YOU WANT TO JUST DISPLAY,

SELECT Y X,X Y FROM TABLE_NAME;

ISN'T THIS SIMPLE THAN SANTHI.K DID.

Is This Answer Correct ?    5 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there a 64 bit version of ssms?

965


What is duration in sql profiler trace?

1088


What is pessimistic concurrency control? : Transact sql

1095


What is view? Can we update view

1451


what is heap table? : Sql dba

1113


What are analytic functions in sql?

1035


Is sql easier than java?

1022


What does where 1/2 mean in sql?

1091


how to install mysql? : Sql dba

1119


how many ways we can we find the current date using mysql? : Sql dba

1107


Is a table valued function object?

1027


What do you mean by “trigger” in sql?

1091


What are types of exception?

924


What is the advantage of index in sql?

976


what is an alias command? : Sql dba

1123