Hi,
I have numeric values stored in Char(12) fields in TABLE1 that need to be Inserted/Converted into TABLE2 in numeric (decimal) fields.
I've written the following code:
Code:
INSERT INTO dbo.TABLE2
(
ITEM_QUANTITY,
ITEM_VALUE,
)
SELECT
CAST(dbo.TABLE1.SOS_QUANTITY_12 AS DECIMAL),
CAST(dbo.TABLE1.SOS_VALUE_12 AS DECIMAL)
FROM
dbo.TABLE1
WHERE
CAST(dbo.TABLE1.SOS_QUANTITY_12 AS DECIMAL) > 0.0000 AND
CAST(dbo.TABLE1.SOS_VALUE_12 AS DECIMAL) > 0.00
GROUP BY
dbo.TABLE1.SOS_QUANTITY_12,
dbo.TABLE1.SOS_VALUE_12
[u]
TABLE1 fields:</u>
SOS_QUANTITY_12
is a CHAR field
Length 12
with example values such as (12.0204 and 10.23)
SOS_VALUE_12
is a CHAR field
Length 12
with example values such as (12.02 and 10.2)
PROBLEMS
1. is that values which are between 0 and 1 (i.e. 0.3 in TABLE1) are not Inserted into TABLE2.
2. is that the values like '2.3' in TABLE1 are being stored as whole numbers i.e. 2 TABLE2.
[u]
TABLE2 fields:</u>
QUANTITY
is stored as
DECIMAL
LENGTH 9
PRECISION 18
SCALE 4
VALUE
is stored as
DECIMAL
LENGTH 9
PRECISION 18
SCALE 2
Any ideas please?
Thanks in advance.
Neal
A Northern Soul