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

How to adapt or map data to sql?

How to adapt or map data to sql?

How to adapt or map data to sql?

Does anyone have any ideas on how I would go about setting up a sql program or any other type of program that could take a tab delimited ASCII file and be able to add the information to a table based on mapping constraints. For example, the ASCII file would look like this:
Code1 Code2 Breed DogID Description
B1 C2 Collie 43 brown with spots

The program would need to understand that a dog from (B1, C2) would belong in my category# 198 so my table would look like this.

Code Breed DogID Description
198 Collie 43 brown with spots

Please let me know if you have any thoughts or ideas where I could find information.

RE: How to adapt or map data to sql?

Depends on what dbase you are using but if you didn't want to write programs to parse the data, then I would create an input table with columns matching the inital ascii text file and then write an 'on_insert' trigger (dbase specific syntax) which fired on insert and contained the logic which will perform the data manipulation, probably inserting data into another table.

RE: How to adapt or map data to sql?

Thank you for your response, I need to read up a bit on triggers. Does you or anyone know if there is a way to do something like this?

insert into NEWTABLE (Code) values (198) AND select breed, dogid, description from OLDTABLE where (Code1=B1) AND (Code2=C2);

I'm trying to add a when clause to an insert statement. So, for this example, I wanted to use 198 in the new table with all the same other information from the old table except the codes. Let me know what you think?

RE: How to adapt or map data to sql?

insert into NEWTABLE
(select 198, breed, dogid, description
where code1='B1' and code2='C2');

Should work (I think). If 198, 'B1' and 'C2' are
not constants then you'll need to wrap the whole
lot up in into a procedure and pass these in as

What database server are you using ?

RE: How to adapt or map data to sql?

Why not import the table to the server as is? Then set up one more table that has Code1, Code2, and Code (a map or ownership table) showing the relationship between The other codes and your categorization. Then build your final output view on the server using this SQL:

CREATE VIEW myFinalDogShowView as (Select Code, Breed, DogID, Description FROM oldtable INNER JOIN maptable ON oldtable.code1 = maptable.code1 and oldtable.code2 = maptable.code2)

This presumably gives you a permanently updatable dog categorization library as new ASCII files roll in.

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