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. How do you import a CSV file into MS SQL?

How do you import a CSV file into MS SQL?

Scheduled Pinned Locked Moved Database
questiondatabasemysqlsql-serversysadmin
4 Posts 3 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.
  • M Offline
    M Offline
    mcljava
    wrote on last edited by
    #1

    Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax: LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands? If not, what is the recommended method for importing files? Mike Luster CTI/IVR/Telephony SME

    M J 2 Replies Last reply
    0
    • M mcljava

      Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax: LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands? If not, what is the recommended method for importing files? Mike Luster CTI/IVR/Telephony SME

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      There are several interfaces to enter SQL commands for SQL Server: Query Analyzer (a GUI application), isql.exe and osql.exe, plus sqlcmd.exe in SQL Server 2005. For performing a bulk file import, you would normally use either bcp.exe (stands for Bulk CoPy) or the BULK INSERT statement. Stability. What an interesting concept. -- Chris Maunder

      1 Reply Last reply
      0
      • M mcljava

        Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax: LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands? If not, what is the recommended method for importing files? Mike Luster CTI/IVR/Telephony SME

        J Offline
        J Offline
        Jorge Novo
        wrote on last edited by
        #3

        You need the MS SQL server enterprise manager there you will find a tool just to import and export data for just about anything. Hear,See,Learn,Understand,Practice Many can be good,but only ONE can be the best keep practicing

        M 1 Reply Last reply
        0
        • J Jorge Novo

          You need the MS SQL server enterprise manager there you will find a tool just to import and export data for just about anything. Hear,See,Learn,Understand,Practice Many can be good,but only ONE can be the best keep practicing

          M Offline
          M Offline
          mcljava
          wrote on last edited by
          #4

          Thanks guys, I used Enterprise Manager and it was pretty simple for importing 37K rows of CSV data. Getting data into your database is easy BUT... when I create a Table Definition importing to that seems to need some extra work. I get the impression I'll have to write a Stored Procedure in TSQL to convert the data into the desired custom Table Format. Recommendations welcome. Mike Luster CTI/IVR/Telephony SME

          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