Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6065019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:20:38+00:00 2026-05-23T09:20:38+00:00

I have CSV file with three columns. sno sname quantity — —– ——– 1

  • 0

I have CSV file with three columns.

sno  sname  quantity
---  -----  --------
 1   aaa    23
 2   bbb    null
 3   ccc    34
 4   ddd    ddd
 5   eee    xxx
 6   fff    87

Table in the SQL Server database is as following/

CREATE TABLE csvtable
(       sno         int
    ,   sname       varchar(100)
    ,   quantity    numeric(5,2)
)

I created an SSIS package to import csv file data into the database table. I am getting an error during package execution because the quantity is a string. I created another table to store the invalid data.

CREATE TABLE wrongcsvtable
(       sno         nvarchar(10)
    ,   sname       nvarchar(100)
    ,   quantity    nvarchar(100)
)

In the csvtable, I would like to store the following data.

sno  sanme   quantity
---  ------  --------
 1   aaa     23
 3   ccc     34
 6   fff     87

In the wrongcsvtable, I would like to store the following data.

sno  sanme   quantity
---  ------  --------
 2   bbb     null
 4   ddd     ddd
 5   eee     xxx

Could someone point me in the right direction to achieve the above mentioned output?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:20:38+00:00Added an answer on May 23, 2026 at 9:20 am

    Here is one possible option. You can achieve this using the Data Conversion transformation within the Data Flow Task. Following example shows how this can be achieved. The example uses SSIS 2005 with SQL Server 2008 database.

    Step-by-step process:

    1. Create a file named FlatFile.CSV and populate it with data as shown in screenshot #1.

    2. In the SQL database, create two tables named dbo.CSVCorrect and dbo.CSVWrong using the scripts provided under SQL Scripts section. The fields in the table dbo.CSVWrong should have the data types VARCHAR or NVARCHAR or CHAR so that it can accept the invalid records.

    3. On the SSIS package, create an OLE DB connection named SQLServer to connect to SQL Server database and create a Flat File Connection named CSV. Refer screenshot #2. Configure the flat file connection CSV as shown in screenshots #3 – #7. All the columns in the flat file connection should be configured as string data type so that the package doesn’t fail while reading the file.

    4. On the Control Flow tab of the package, place a Data Flow Task as shown in screenshot #8.

    5. On the Data Flow tab of the package, place a Flat File Source and configure it as shown in screenshots #9 and #10.

    6. On the Data Flow tab of the package, place a Data Conversion transformation and configure it as shown in screenshot #11. Click on the Configure Error Output and change the Error and Truncation column values from Fail component to Redirect row. Refer screenshot #12.

    7. On the Data Flow tab of the package, place an OLE DB Destination and connect the green arrow from Data Conversion to this OLE DB Destination. Configure the OLE DB Destination as shown in screenshots #13 and #14.

    8. On the Data Flow tab of the package, place another OLE DB Destination and connect the red arrow from Data Conversion to this OLE DB Destination. Configure the OLE DB Destination as shown in screenshots #15 and #16.

    9. Screenshot #17 shows the Data Flow Task once it has been completely configured.

    10. Screenshot #18 shows data in the tables before the package execution.

    11. Screenshot #19 shows package execution within Data Flow Task.

    12. Screenshot #20 shows data in the tables after the package execution.

    Hope that helps.

    SQL Scripts:

    CREATE TABLE [dbo].[CSVCorrect](
        [Id] [int] IDENTITY(1,1) NOT NULL,
        [SNo] [int] NULL,
        [SName] [varchar](50) NULL,
        [QuantityNumeric] [numeric](18, 0) NULL,
    CONSTRAINT [PK_CSVCorrect] PRIMARY KEY CLUSTERED ([Id] ASC)) ON [PRIMARY]
    GO
    
    CREATE TABLE [dbo].[CSVWrong](
        [Id] [int] IDENTITY(1,1) NOT NULL,
        [SNo] [varchar](50) NULL,
        [Quantity] [varchar](50) NULL,
        [SName] [varchar](50) NULL,
        [ErrorCode] [int] NULL,
        [ErrorColumn] [int] NULL,
    CONSTRAINT [PK_CSVWrong] PRIMARY KEY CLUSTERED ([Id] ASC)) ON [PRIMARY]
    GO
    

    Screenshot #1:

    1

    Screenshot #2:

    2

    Screenshot #3:

    3

    Screenshot #4:

    4

    Screenshot #5:

    5

    Screenshot #6:

    6

    Screenshot #7:

    7

    Screenshot #8:

    8

    Screenshot #9:

    9

    Screenshot #10:

    10

    Screenshot #11:

    11

    Screenshot #12:

    12

    Screenshot #13:

    13

    Screenshot #14:

    14

    Screenshot #15:

    15

    Screenshot #16:

    16

    Screenshot #17:

    17

    Screenshot #18:

    18

    Screenshot #19:

    19

    Screenshot #20:

    20

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file with three columns (A,B,C). I can record a Macro
I have a table with 600+ columns imported from a CSV file with special
I have a CSV file that has rows, where data for some columns only
I have a CSV file that contains over 80,000 rows and 100 columns. I'm
I have a csv file with 350,000 rows, each row has about 150 columns.
I have a CSV data file with rows that may have lots of columns
I have a CSV file, which contains three dates: '2010-07-01','2010-08-05','2010-09-04' When I try to
I have loaded a csv file to R. There are 10 columns in the
I have csv file with 14 columns and I want to sort it in
I have a CSV file with 5 columns. Using Python, how can I delete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.