dbTalk Databases Forums  

Breaking up a Table

comp.database.ms-sqlserver comp.database.ms-sqlserver


Discuss Breaking up a Table in the comp.database.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
The Bear
 
Posts: n/a

Default Breaking up a Table - 04-20-2005 , 12:19 PM






I hope I can get this across clearly.

I have a table that needs to be broken into 3 tables.
Col1 Col2 Col3 Col4 Col5 Col6 Col7

Col1 and Col2 need to go into LookupTable1
Col3 and Col4 into LookupTable2

If Col5 is twice the width.... haha just kidding...

so Col5 and Col6 go into LookupTable3

There is a 4th table which is made up of foreign keys which are the PK of
LookupTable1,2,3

My questions is, how to get the data from the columns of each row and add it
to its respective lookuptable
and sequentially step throw the table to repeat the above step until I've
processed each row

thanks folks

T.B



Reply With Quote
  #2  
Old   
David Gugick
 
Posts: n/a

Default Re: Breaking up a Table - 04-20-2005 , 12:38 PM






The Bear wrote:
Quote:
I hope I can get this across clearly.

I have a table that needs to be broken into 3 tables.
Col1 Col2 Col3 Col4 Col5 Col6 Col7

Col1 and Col2 need to go into LookupTable1
Col3 and Col4 into LookupTable2

If Col5 is twice the width.... haha just kidding...

so Col5 and Col6 go into LookupTable3

There is a 4th table which is made up of foreign keys which are the
PK of LookupTable1,2,3

My questions is, how to get the data from the columns of each row and
add it to its respective lookuptable
and sequentially step throw the table to repeat the above step until
I've processed each row

thanks folks

T.B
Since your DDL is a mystery, I'll assume col1 and col2 are an
ID/Description combo:

Insert Into LookupTable1 (
col1,
col2 )
Select DISTINCT Col1, Col2
From Table

etc...


--
David Gugick
Imceda Software
www.imceda.com



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.