Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Export .Dat to SQL-server

Export .Dat to SQL-server

Export .Dat to SQL-server

I currently got a legacy program on my table. The program was written almost 30 years ago (1984) and have been running since.
The customer want to transfer data to a SQL-server.
I do not have the source code but the client claims that Pascal was used so therefor I post in this forum since my Pascal knowledge is some what limited(nonexistant)
Is there some way to see if it is a Pascal datafile and if it is how do I get it to a SQL server?

With hope for help

RE: Export .Dat to SQL-server


Quote (Tomas)

Is there some way to see if it is a Pascal datafile and if it is how do I get it to a SQL server?
There is no such thing like "Pascal datafile". There is no way to find out the structure from the data files. You can only guess.

If you can start over with a clean data file and check the changes after each operation you do with the program, then you have a chance to guess enough to be able to write an (partial) export tool.

But if the records can have variable length and certain data types are packed somehow, you will have to debug the program itself too. Be prepared for a task hard even for a Pascal guru.

An alternative if the program has text user interface and displays the data from the file in a fairly structured manner, to run it in a terminal emulator, send it keystrokes to navigate over the data file then save the text displayed in the terminal on each step. Then write a program which parses the saved texts and rebuilds the data. Of course, coding such automation can be a tedious task and such solution can be extremely slow.

Before beginning, have you searched the web ? Maybe someone had to do the same migration in the past and published his experiences.


RE: Export .Dat to SQL-server


Thank you for your reply :)
I have searched the web but I do not have that much to go on.
I found a post in this forum regarding .Dat to txt migration that is simular.
If I can get it to a deliminated text that's enough.
I have opened it in Notepad++ and I can see the data but I can not find how it is separated. A lot of NUL segments.
Was thinking about doing a macro that cleans the file.

RE: Export .Dat to SQL-server


Quote (Tomas)

I can see the data but I can not find how it is separated.
Most probably there is no separator. If you are lucky, those are fixed length records. See how the file size changes when you add new records. If the size always increases with the same amount, then try to split the files content in chunks of that size. ( Start splitting from the end. At the beginning of the file may be an additional header piece of different size. ) The putting the chunks one below the other, search for similarities to guess the field limits.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close