I try to load a csv file whose content is below, into a SQL Server 2012 database table NYC_Business_Establishment_DataSet using the "Bulk Insert Task" in SSIS 2012 control flow. The control flow task complete without any error, but I cant see this record in the target table. Please advice.
CSV File Content
DBA,Establishment Street,Establishment Zip,Establishment Borough,Business Sector,Establishment Category,Type of Cuisine,Number Of Employees,Actual Opening Date
Palermo Salumeria,33-35 Francis Lewis Blvd,11358,Queens,,,,,
Foragers City Grocers,300 West 22nd Street,10011,Manhattan,,,,,
Cultural Xchange,35 Lafayette Ave,11217,Brooklyn,,,,3,
Target Table USE [DB] GO
/****** Object: Table [dbo].[NYC_Business_Establishment_DataSet] Script Date: 5/19/2017 3:31:55 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[NYC_Business_Establishment_DataSet](
[DBA] [varchar](1000) NULL,
[Establishment Street] [varchar](1000) NULL,
[Establishment Zip] [int] NULL,
[Establishment Borough] [varchar](100) NULL,
[Business Sector] [varchar](1000) NULL,
[Establishment Category] [varchar](1000) NULL,
[Type of Cuisine] [varchar](100) NULL,
[Number Of Employees] [int] NULL,
[Actual Opening Date] [date] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
Thanks
There is a problem with input data file. For he last two columns [Number Of Employees],[Actual Opening Date], the data in the file was empty string and not null. So it is getting failed.
I am able to load the file using Data Flow Task. Added Derived column transformation to cast the strings to NULLs.
TRIM([Number Of Employees]) == "" ? NULL(DT_I4) : (DT_I4)[Number Of Employees]
TRIM([Actual Opening Date]) == "" ? NULL(DT_DBDATE) : (DT_DBDATE)[Actual Opening Date]