| Author |
Topic |
|
diva
Starting Member
9 Posts |
Posted - 2007-07-24 : 05:54:17
|
Hi AllPlease can someone help meI Have a problem whereby I cannot get the contents of two columns to add togethermy code is update RN_20000718115255CounterParty1set[RN_20000718115255CounterParty1].[19] =([RN_20000718115255CounterParty1].[19]) + ([RN_20000718115255CounterParty1].[17])could someone please advise where i have gone wrongthanks & regards  |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-24 : 05:56:08
|
| is there an error you get or worng sums or what?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-24 : 06:05:34
|
You need spacing before and after the SETUPDATE RN_20000718115255CounterParty1SET [RN_20000718115255CounterParty1].[19] = [RN_20000718115255CounterParty1].[19] + [RN_20000718115255CounterParty1].[17] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
diva
Starting Member
9 Posts |
Posted - 2007-07-24 : 06:07:14
|
Thanks ever so much that has worked a treat |
 |
|
|
diva
Starting Member
9 Posts |
Posted - 2007-07-24 : 07:03:12
|
Thanks for the reply however when i run the queryit appears not to be summing the two amounts together but justconcatenating them ie: in column 17 I have 57.00 & column 19 i have2.00 I want it to display 59.00 |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-24 : 07:15:38
|
your column must be a varchar not integer.use convert() function to convert to integer or decimal, perform you addition then convert back to varchar() KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
diva
Starting Member
9 Posts |
Posted - 2007-07-24 : 07:42:12
|
| Thanks for your reply but i am not sure how to do thisExtremely sorry |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-24 : 07:54:03
|
[code]UPDATE RN_20000718115255CounterParty1SET [RN_20000718115255CounterParty1].[19] = CONVERT(varchar(10), CONVERT(decimal(10,2), [RN_20000718115255CounterParty1].[19]) + CONVERT(decimal(10,2), [RN_20000718115255CounterParty1].[17]) )[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
diva
Starting Member
9 Posts |
Posted - 2007-07-24 : 07:56:25
|
| that is absolutly fantastic it is just what i needthanks very very much |
 |
|
|
|