Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-09 : 11:37:35
|
| Table AColID ColA ColB ColCColID is primary key column. ColA and ColB are also integer.If I would like to do some calculation. Eg (ColA * 2 + ColB), and then put into ColC.Any way to do it?be a hardworking people!! |
|
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-09 : 11:43:59
|
| To be more specfic, how to construct a insert query to do so ?or any othe options and they difference/be a hardworking people!! |
 |
|
|
nosepicker
Constraint Violating Yak Guru
366 Posts |
Posted - 2005-08-09 : 11:44:20
|
| UPDATE [Table A] SET ColC = ColA * 2 + ColB |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2005-08-09 : 11:44:35
|
| [code]UPDATE [Table A]SET ColC = (ColA * 2) + ColB[/code]Or is there more to it than that?Mark |
 |
|
|
nosepicker
Constraint Violating Yak Guru
366 Posts |
Posted - 2005-08-09 : 11:46:03
|
| If values for ColA and ColB have not already been populated for the table:INSERT INTO [Table A] SELECT ColID, ColA, ColB, ColA*2 + ColB FROM ... |
 |
|
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-09 : 12:16:02
|
| I see, Thx!be a hardworking people!! |
 |
|
|
|
|
|