Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

how to import excel file into sql server using identity column Expand / Collapse
Author
Message
Posted Thursday, August 1, 2013 2:18 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, June 20, 2014 3:46 AM
Points: 18, Visits: 157
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.
Post #1479827
Posted Thursday, August 1, 2013 3:05 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
Import it into a table using SSIS. Create the table before import and add the ID column with the IDENTITY property.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1479839
Posted Thursday, August 1, 2013 3:06 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
Or just import it into the table and add the column later on (using the GUI) with the IDENTITY property.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1479840
Posted Thursday, August 1, 2013 4:02 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, June 20, 2014 3:46 AM
Points: 18, Visits: 157
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)
Post #1479853
Posted Thursday, August 1, 2013 4:41 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
Save the SSIS package and edit it with BIDS to see what is wrong.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1479869
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse