how to import excel file into sql server using identity column

  • I have an excel file with email ids as one column.i want those email ids into the database along with new column as autoid in which identity column must be used.I am able to import only emails id.but i want it along with autoid generation.So can you please help me.

    For example: i have

    emailds

    abc@gmail.com

    xyz@gmail.com

    but what i want is

    autoid emaild

    1 abc@gmail.com

    2 xyz@gmail.com

    in which autoid should generate automatically.

  • Import it into a table using SSIS. Create the table before import and add the ID column with the IDENTITY property.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Or just import it into the table and add the column later on (using the GUI) with the IDENTITY property.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thankyou for your reply . i created a table before .. see for example i created ...

    CREATE TABLE [dbo].[Allemailids] (

    [AutoID] int identity(1,1),

    [Email ID's] nvarchar(255)

    )

    and when now using import and export it is throwing some error.These are the error messages i am getting:

    Copying to [dbo].[Listofallemailds] (Error)

    Messages

    Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.

    An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Unspecified error".

    (SQL Server Import and Export Wizard)

    Error 0xc020901c: Data Flow Task 1: There was an error with input column "AutoID" (55) on input "Destination Input" (33). The column status returned was: "The value violated the integrity constraints for the column.".

    (SQL Server Import and Export Wizard)

    Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (33)" failed because error code 0xC020907D occurred, and the error row disposition on "input "Destination Input" (33)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.

    (SQL Server Import and Export Wizard)

    Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - Listofallemailds" (20) failed with error code 0xC0209029 while processing input "Destination Input" (33). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.

    (SQL Server Import and Export Wizard)

    Error 0xc0209017: Data Flow Task 1: Setting the end of rowset for the buffer failed with error code 0xC0047020.

    (SQL Server Import and Export Wizard)

    Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - Individual$" (1) returned error code 0xC0209017. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.

    (SQL Server Import and Export Wizard)

  • Save the SSIS package and edit it with BIDS to see what is wrong.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply