Import text file data into SQL Server table

1118895 pts.
Tags:
SQL Server
text files
My table in SQL Server has several columns and a text file. Now, I need to import information from the text file into that table. It's basically two columns that need to be imported. How can I do that? What's the best approach?

Answer Wiki

Thanks. We'll let you know when a new response is added.

You have 2 option

  • INSERT INTO SELECT inserts into an existing table.
  • SELECT INTO creates a new table and puts the data in it.
If the text file is laid out properly you can select the data from here, substring the positions for the individual columns and then doing the insert.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: