Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    116

    Unanswered: Breaking up 1 table that already have data and constrainst into 2 more smaller table

    Hi Guys,

    I have a bad situation here, I have a table with data in it, around 15000 records, and now we need to split some of the columns in this table to form
    its own table, and then load the required data into this new table, so what is the best way of performing this operation

    Let me explain this using an example

    I have a table called "rulename" which contains the following fields
    1) RuleNameid
    2) Area
    3) Pin

    Sample data in the rulename table looks something like below
    Rulenameid, area,pin,
    1,S,2

    Now we plan to transfer all data in the area column in a separate table and make the the area column in the rulename table to be a foreign key.

    So for example, the new area table might look something like this

    Areaid, areaname, areafullname
    1, S, Shield

    So the rulename table will now look like this

    Rulenameid, areaid, pin,
    1,1,2

    So how do perform this operation of data transfer and then updating the "rulename" table to have this existing column as a foreign key,
    Appreciate if someone could point out a good way of getting this done..
    thank you very much

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool



    You can use standard SQL statements to:

    1) CREATE new table.
    2) UPDATE missing columns.

    Or do you want us to do your job?
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Feb 2005
    Posts
    116
    Quote Originally Posted by LKBrwn_DBA

    Or do you want us to do your job?
    [/COLOR][/SIZE]
    ha ha , tht sounds great, let me try it out first..

Posting Permissions

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