Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Bulk Insert

Bulk Insert

Scheduled Pinned Locked Moved Database
databasehelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    varshavmane
    wrote on last edited by
    #1

    Hello All, I am developing a Windows Service in which I download some data from net. Data which I download is in text file. Text file contains the data and column name of the Table and is seperated by $. Something like this : C1$C2$C3$C4$C5$C6$C7$C8$C9$C10$C11$C12$C13$C14$C15$C16$C17$C18$C19$C20$C21$C22$C23$ 5476771$6638853$I$$5476771-2$$$20071003$DIR$$$$$$N$$$20071003$OT$$N$N$UNITED STATES$ 5476957$6689344$I$$5476957-7$20070927$$20071002$DIR$$$59$YR$F$N$142$LBS$20070930$OT$$N$Y$UNITED STATES$ I worte the following Query for Bulk Insert:

    BULK INSERT dbo.tb_DEMO
    FROM 'C:\DEMO08Q1.TXT'
    WITH
    (
    FIELDTERMINATOR ='$'
    )

    I am facing 2 problems in this: 1: I have to delete the column Names from the file and then fire this query. 2: If I delete the column Names then it works but in the last column the data is inserted with $. example: UNITED STATES$ Please help me.... Thanks in Advance.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups