Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


SQL insert into statement from text file

Posted on 2011-03-25
Medium Priority
Last Modified: 2012-05-11
Hi Experts,

I have an sql database table that contains three fields:  LoanNumber, Borrower, LoanProgram. I have a text file that contains three values per line with a semicolon as the delimiter. I'm trying to write an insert into statement that will add rows to the database from the text file. What's wrong with my statement below?  Thanks.
use DataEase

insert into LockData ('LoanNumber', 'Borrower', 'LoanProgram')
from 'c:\SPECPROG.txt' 
with (FieldTerminator = ';')

Open in new window

Question by:asmyatt
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Expert Comment

ID: 35218251
I believe that a semi colon is a special character in SQL.  Can you change the delimiter to something else?
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 35218293
If you use managent studio it has an import wizard that can do this.
LVL 32

Accepted Solution

Ephraim Wangoya earned 2000 total points
ID: 35218295

use BULK insert instead


Author Closing Comment

ID: 35218380
Works good. Thanks

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question