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
How to avoid using cursors? What to use instead of cursor and in what cases to do so?
Can we edit a view in sql?
How consistent is the view of the data between and within multiple sessions, transactions or statements ?
Does asenumerable execute the query?
Explain spool.
Which tcp/ip port does sql server run?
Can we use join in subquery?
What are tables in sql?
how to drop an existing index in mysql? : Sql dba
How do you use collections in procedure to return the resultset?
What is difference between nchar and nvarchar?
Can you join views in sql?
How to change sql*plus system settings?
what are the difference between clustered and a non-clustered index? : Sql dba
How many sql are there?