I am importing a CSV into a database table. I've got it loaded into its own table and I am using that table to feed 2 related tables so that the data is easier to see on a Power BI dashboard. When I attempt to copy some data from the original table I get the following error.
Msg 8152, Level 16, State 2, Procedure Update_Licence_Tables, Line 42 [Batch Start Line 2]
String or binary data would be truncated.
This is weird as the column that is causing the issue is nvarchar(255) and the destination column is also nvarchar(255). I am unsure why this error is occurring when the data types are identical.
Here is the INSERT INTO that is throwing the error. #WLD is the temp table the CSV info is saved to.
SET @active_id = (SELECT TOP(1) id FROM #WLD);
INSERT INTO WELL_LICENCE_DATA (licence_number, licence_status, unique_well_identifier, deemed_asset_amount, deemed_liability_amount_total, pvs_value_applied, active_indicator)
SELECT F1, F2, F3, CONVERT(decimal(18, 2), REPLACE(REPLACE(REPLACE(F4, '$', ''), ',', ''), ' ', '')), CONVERT(decimal(18, 2), REPLACE(REPLACE(REPLACE(F5, '$', ''), ',', ''), ' ', '')), F6, REPLACE(F7, ' ', '')
FROM #WLD
WHERE id = @active_id;
Is there a way to force ignore this warning or a known issue and fix?
Any insights are appreciated