Bulk import CVS file (comma delimited)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ZofiaKow
    New Member
    • May 2012
    • 1

    Bulk import CVS file (comma delimited)

    I need help with BULK import - I have a file with 5 columns(sample below). I need to import data to existing table, use Identity(alredy defined in the table). I do not want to import the last column (it is a row # and I do not need it) also date is provided as 'yyyymmdd' ex 20050817 should be imported into field with DATE type. Can I do it using format file? How can I skip the columna and convert date? There is more then a million rows. Thanks a lot! Sophie
    Source file:
    123456789,00000 000000000000018 ,20050817,TEXT1 ,3
    123456788,00000 000000000000018 ,20050817,TEXT2 ,4

    Destination table:- indexed on CORSP_ID
    CREATE TABLE [dbo].[Correspondence](
    [CORSP_ID] [bigint] IDENTITY(1,1) NOT NULL,
    [SS] [int] NOT NULL,
    [LETTER_CODE] [int] NULL,
    [LETTER_DATE] [datetime] NULL,
    [LETTER_DESCRIPT ION] [nvarchar](100) COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL,
    CONSTRAINT [PK_CDX_CORSP] PRIMARY KEY CLUSTERED
    ([CORSP_ID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Using format file is probably the best way of doing this. Here, read some of this

    Good Luck!!!


    ~~ CK

    Comment

    • developergarage
      New Member
      • May 2012
      • 4

      #3
      try using SSIS for bulk import....

      Comment

      Working...