Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: DTS Help

  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DTS Help

    I've got a | delimited file that I am using to import into a sql table. The problem is that there are three fields (UPC, Location & QOH) that I am concerned with. The table that I need to update, I have to first convert the UPC in the file to an id located in another table and then convert the Location into another id located in a third table and then update the QOH based on the two ids in the first table. I know how to do a straight import from a text file into a single table, but I can't figure out how to look up the values in the other two tables for the reference fields. Any help would be greatly appreciated.

    Thanks,
    Neo

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    I don't think you can do that without using a language of some kind, whether PL/SQL/equivalent or something higher-level, like PHP. Not just a straight import.
    Personally, I'd throw together a quick script in Perl, PHP, ASP, or whatever I had available.

    What DBMS are you using? You didn't say. (unless DTS is a db...?)

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's a SQL 2000 db. The project that I am working on the client wants to automate the upload of the file into the database. But with the fields not matching up and having to look up the ids from other tables, I don't know excatly how to do this.

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    I'd use ASP.net or PHP or something to process the file, personally.
    Whatcha got on the server? Even perl or regular ASP...

    They upload the file, the server-side script parses it out and uploads it. Otherwise I don't know if you can do that with fields not matching and all. At the very least you'd need a stored procedure that executes to do the lookups.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •