Hi @kkran
You may use Execute SQL Task to do that.
Step1: Create a staging table first in your database with below code. And then load the csv file data to the staging table first.
CREATE TABLE staging table ([Part_Number] [varchar](50) NULL,
[Org_Name] [varchar](500) NULL,
[Month1] VARCHAR(MAX) NULL,
[Month2] VARCHAR(MAX) NULL,
[Month3] VARCHAR(MAX) NULL,
[Month4] VARCHAR(MAX) NULL)
Step2: Add the Execute SQL Task with below command.
declare @count int
select @count = (SELECT sum(CASE WHEN CHARINDEX('.',[Month1],0) > 0 THEN 1
WHEN CHARINDEX('.',[Month3],0) > 0 THEN 1
WHEN CHARINDEX('.',[Month2],0) > 0 THEN 1
WHEN CHARINDEX('.',[Month4],0) > 0 THEN 1 ELSE 0
END)
FROM
staging table)
if @count >0
begin
raiserror('There is decimal in my_table',16,1)
end
else
begin
INSERT INTO TABLEA SELECT * FROM staging table
end
And then it will throw error/fail the process if there is a decimal value in the file.
Regards,
Zoe Hui
If the answer is helpful, please click "Accept Answer" and upvote it.