Solved

Importing ASCII data into SQL database

Posted on 2014-01-08
5
761 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Are you speaking specially about single quotes? Just duplicate them. VB code:
correctString=ASCIIString.Replace("'","''")
0
 

Author Comment

by:Rupert Eghardt
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now