Solved

SQL insert into statement from text file

Posted on 2011-03-25
4
299 Views
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

0
Comment
Question by:asmyatt
[X]
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
4 Comments
 
LVL 11

Expert Comment

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

Expert Comment

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

Accepted Solution

by:
Ephraim Wangoya earned 500 total points
ID: 35218295

use BULK insert instead

BULK INSERT LockData
FROM 'c:\SPECPROG.txt'
WITH
(
   FIELDTERMINATOR =',',
   ROWTERMINATOR = '\n'
)
0
 
LVL 2

Author Closing Comment

by:asmyatt
ID: 35218380
Works good. Thanks
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

728 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