Bulk insert

  • Hi,

    I have a csv which is generated every day with 50 cols and 50000 rows.

    I want only selected col values, which i want to insert in a table.

    Is it possible using Bulk insert or BCP? How? Can you people mention the code please?

    Note: we cant use SSIS/DTS

    Thanks

    smeet

  • Take a look at OpenRowSet in Books Online. You can use that to query CSV files, text files, etc.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi Grass

    I normally use create table and import it using OPENDATASOURCE.

    (SAMPLE)

    INSERT INTO IMPORTDATA

    SELECT *

    FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source=[File location]\;Extended Properties="Text;HDR=No;FMT=Delimited"')...TEXT#csv (your csv filename, replace the . with a #)

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

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