I am loading data from a CSV file to a staging table (using BULK INSERT) where all column types are NVARCHAR(100). This works well.
The idea is then to insert that data into the productive table and while doing that changing the data types.
When trying to convert a column with numeric values from NVARCHAR to DECIMAL, all decimals are gone.
Create and insert from staging table to production table:
DROP TABLE IF EXISTS [dbo].[factFinanzbuchhaltung]
GO
CREATE TABLE [dbo].[factFinanzbuchhaltung]
(
Wert DECIMAL
)
GO
INSERT INTO [dbo].[factFinanzbuchhaltung]
SELECT CONVERT(DECIMAL(25, 2), ROUND(Wert,2))
FROM [dbo].[Stage_factFinanzbuchhaltung]
how the data looks before and after conversion
What am I doing wrong? I feel like I tried very combination of CONVERT, CAST and number of decimals. With our without rounding.