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. General Programming
  3. Visual Basic
  4. Import Text File into Sql Server 2000

Import Text File into Sql Server 2000

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdatabasesql-server
2 Posts 2 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.
  • _ Offline
    _ Offline
    _mubashir
    wrote on last edited by
    #1

    Hello All, I have an application in VB.NET 2003, I want to import a delimiter text file into SQL Server. How do I go about doing this with vb.net code? Please help me out! regards Mubashir

    A 1 Reply Last reply
    0
    • _ _mubashir

      Hello All, I have an application in VB.NET 2003, I want to import a delimiter text file into SQL Server. How do I go about doing this with vb.net code? Please help me out! regards Mubashir

      A Offline
      A Offline
      amfy
      wrote on last edited by
      #2

      hi Mubashir, its not clear what kind of process would u like to proceed. assuming you want to insert the data into table from file.try using BULK INSERT statement available on sql server2000. If you want to exec a select query stored in a text file there is no straight method to procede. i've manipulated some different approach for that, assuming you have entere some "select * from Products" in a text file called test.txt. the steps involved are as, Declare @cmd varchar(100) Declare @sqlcmd varchar(2000) set @cmd = 'type e:\test.txt' CREATE TABLE #temptable (id int identity(1,1), string VARCHAR(4000)) Insert #temptable exec master..xp_cmdshell @cmd Declare @Max int, @Min int select @sqlcmd=string from #temptable Drop Table #temptable Exec(@sqlcmd) stay smart

      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