| Author |
Topic  |
|
|
Pinto
Aged Yak Warrior
United Kingdom
590 Posts |
Posted - 03/13/2007 : 10:52:30
|
I have the following sp which is appending records into my table. However the values appended are being round up eg
SC_PrimaryPupilPrice is 1.5
but when it is inserted into the sql table it is 2
The field in the sql table is numeric.
CREATE PROCEDURE spSM_AddWeeksandMealPrices
@dteWeekEnding datetime
as
INSERT INTO tblSM_Meals (ML_Id, ML_WeekEnding, ML_SchoolNumber, ML_PupilMealPrice, ML_AdultMealPrice, ML_SpillagesMealPrice, ML_AdultRechargeMealPrice, ML_ReservedMealPrice)
select convert(varchar,@dteWeekEnding ,103) + '*' + cast(SC_SchoolNumber as varchar(10)) , convert(datetime,@dteWeekEnding ,106), SC_SchoolNumber, SC_PrimaryPupilPrice, SC_PrimaryAdultPrice, SC_PrimaryPupilPrice, SC_PrimaryAdultPrice, SC_PrimaryAdultPrice from tblSM_Schools GO |
|
|
harsh_athalye
Flowing Fount of Yak Knowledge
India
5509 Posts |
Posted - 03/13/2007 : 10:58:30
|
What is the data type, precision and scale for ML_PupilMealPrice field?
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Pinto
Aged Yak Warrior
United Kingdom
590 Posts |
Posted - 03/13/2007 : 11:01:10
|
ML_PupilMealPrice is numeric SC_PrimaryPupilprice is float |
 |
|
|
harsh_athalye
Flowing Fount of Yak Knowledge
India
5509 Posts |
Posted - 03/13/2007 : 11:05:45
|
Yes. That is okay, but what is the scale for numeric column.
sp_help 'table_name'
If it is 0 which I guess it is, then that's the root cause of your problem. Change it to allow desired number of decimal places like (25,6) and then try the UPDATE statement.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Pinto
Aged Yak Warrior
United Kingdom
590 Posts |
Posted - 03/13/2007 : 11:09:52
|
0 - I swear I tried to change it to 2 and it reverted back to 0. It has let me change it now and it works. Thank you. I thought I had to do that and when it intially wouldn't change I thought I had another problem. |
 |
|
| |
Topic  |
|