I would like to double the value of column C in a table. Is there a built-in function to achieve this?
Current table
A B C
X 1 2 3
Y 4 5 6
Z 7 8 9
After running the T-SQL or any query table values should be as below
A B C
X 1 2 6
Y 4 5 12
Z 7 8 18
To select the data:
SELECT A,B,C*2 as C
FROM TableName
Result:
A B C
1 2 6
4 5 12
7 8 18
See result in SQL Fiddle.
If you want to update the table:
UPDATE TableName
SET C=(C * 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With