Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Posts
    2

    Wink Unanswered: paging mr smarty pants!

    Hi, I am new to SQL server and I have what I think is probably an easy question. I have table1 that has a long var char and a unique ID. I want to create another table (table2) that has a matching unique ID for the first table and then column(s) of data that defines how the long var char should get sliced up into fields. Then I want a way (stored procedure?) to read the data out of table1, apply the structure/definition from table2 and insert it into a third table. I need to do it quickly and efficiently of course, but I dont know where to start!

    So, to put it simply, heres table1:
    1|pam,mitchell,female,28,hotty<lf>
    2|doug,roberts,male,50,jerk<lf>

    How do I store the data definition in table2 and then how do I apply it and insert the translated records to table3 to get this:
    pam|mitchel|female|28|hotty
    doug|roberts|male|50|jerk

    I know I rambled on with this and probably could have explained better, but the white out on my screen keeps slowing me down :]

    Thanks ahead of time!

  2. #2
    Join Date
    Apr 2003
    Posts
    2

    Smile Re: paging mr smarty pants!

    Come on! Somebody help me pleaseeeeeeee!!!!


    Originally posted by CuteSmartChic
    Hi, I am new to SQL server and I have what I think is probably an easy question. I have table1 that has a long var char and a unique ID. I want to create another table (table2) that has a matching unique ID for the first table and then column(s) of data that defines how the long var char should get sliced up into fields. Then I want a way (stored procedure?) to read the data out of table1, apply the structure/definition from table2 and insert it into a third table. I need to do it quickly and efficiently of course, but I dont know where to start!

    So, to put it simply, heres table1:
    1|pam,mitchell,female,28,hotty<lf>
    2|doug,roberts,male,50,jerk<lf>

    How do I store the data definition in table2 and then how do I apply it and insert the translated records to table3 to get this:
    pam|mitchel|female|28|hotty
    doug|roberts|male|50|jerk

    I know I rambled on with this and probably could have explained better, but the white out on my screen keeps slowing me down :]

    Thanks ahead of time!

  3. #3
    Join Date
    Apr 2003
    Posts
    30
    Create a SP, read the records one by one using cursor, and then parse the string by the format definition.
    Anotherway is to dump the data into a text file and import them by DTS.

  4. #4
    Join Date
    Feb 2003
    Posts
    109

    uh cutesmartchic?

    uh cutesmartchic?

    since you are trying to get help based on how cute you are, ill gladly help you.

    WHEN I SEE YOUR PICTURE!!

    ps- im a sql developer, 4 years
    Access 2002 ADP Rocks my World

    Long live SQL Server and 64bit Windows!!!

  5. #5
    Join Date
    Jan 2003
    Location
    South Bend, IN
    Posts
    1

    Re: paging mr smarty pants!

    If you're only doing this once, using enterprise manager, right click on table1, export the data to table 2, right click on table 2 and go into proporties and change any field you like. When using the import/export feature on enterprise manager, you can save it as a DTS package which can be run later. Hope this helps. Bernie B.

Posting Permissions

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