Solved

Importing ASCII data into SQL database

Posted on 2014-01-08
5
808 Views
Last Modified: 2014-01-28
Hi Guys,

I am importing an ASCII text file into a SQL database.
I have a problem with text-lines in the ASCII file containing special characters.

If a line of text contains a special character (for example in the name / surname) it effects the formatting of that line, and imports incorrectly into the SQL database.

I believe the problem is with the reading of the actual ASCII text file, and the column count.  The special characters seem to move the columns for that line, one or two characters forward.

Is there way of resolving this particular problem?
0
Comment
Question by:Rupert Eghardt
  • 2
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39764973
How are you importing the data? It sounds like you are dealing with Unicode data rather than pure ASCII - so it is more likely an issue with the import mechanism.
0
 

Author Comment

by:Rupert Eghardt
ID: 39765070
I developed a small import application in Clarion, which reads the ASCII file and writes the records into SQL.

Is there a way perhaps to re-save the ASCII file, to get rid of all the special characters?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39765081
Do you not need to preserve the input data as it is? Can you modify your import routine to accept unicode instead? Unicode won't be a problem for SQL Server as long as you are storing it in a NCHAR or NVARCHAR.
0
 
LVL 27

Expert Comment

by:Ark
ID: 39781442
Are you speaking specially about single quotes? Just duplicate them. VB code:
correctString=ASCIIString.Replace("'","''")
0
 

Author Comment

by:Rupert Eghardt
ID: 39783511
I am referring to all sorts of special characters, such as in Spanish, Italian, Russian, etc. surnames.

I think Carl is correct, I should change the import routing, but I don't think Clarion can read Unicode from ASCII, not sure though.

Thanks for the help, I will try to find a way in Clarion to read Unicode.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

810 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