dbTalk Databases Forums  

transform numeric id to uniqueidentier and then populate multiple destination tables with foriegn key

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss transform numeric id to uniqueidentier and then populate multiple destination tables with foriegn key in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alan Cantor
 
Posts: n/a

Default transform numeric id to uniqueidentier and then populate multiple destination tables with foriegn key - 05-14-2004 , 01:33 AM






I want to create rows in multiple tables from a single row.

The source table is called "SITE" and the fields are as follows: (very
simplified)
ID numeric
Name string
Address1 string
Address2 string
Address3 string

The destination will have two separate tables.
SITES and ADDRESSES
where the fields for SITES are:
pkID uniqueidentifier (newid())
Name nvarchar(50)
.........and the fields for ADDRESSES:
pkID uniqueidentifier (newid())
fkSITEID uniqueidentifier
address nvarchar(50)
addressType nvarchar(50)

I need to extract the uniqueidentifier field from the SITE table after it's
been inserted so that I can insert it into the fkSITEID field of the address
records.

Do you have suggestions?
I'm new to dts, but I understand @@identity used in sp's for use with
identity fields.
I thought I would just parse a recordset or sql fetch next as in a fancy
stored procedure, but I really need to learn how to implement in dts.

Any input very much appreciated.
Alan



Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: transform numeric id to uniqueidentier and then populate multiple destination tables with foriegn key - 05-14-2004 , 07:16 AM






Have a third table where you keep reference between numeric id and
uniqueidentifier id.

"Alan Cantor" <acantorcpa (AT) hotmail (DOT) com> wrote

Quote:
I want to create rows in multiple tables from a single row.

The source table is called "SITE" and the fields are as follows: (very
simplified)
ID numeric
Name string
Address1 string
Address2 string
Address3 string

The destination will have two separate tables.
SITES and ADDRESSES
where the fields for SITES are:
pkID uniqueidentifier (newid())
Name nvarchar(50)
........and the fields for ADDRESSES:
pkID uniqueidentifier (newid())
fkSITEID uniqueidentifier
address nvarchar(50)
addressType nvarchar(50)

I need to extract the uniqueidentifier field from the SITE table after
it's
been inserted so that I can insert it into the fkSITEID field of the
address
records.

Do you have suggestions?
I'm new to dts, but I understand @@identity used in sp's for use with
identity fields.
I thought I would just parse a recordset or sql fetch next as in a fancy
stored procedure, but I really need to learn how to implement in dts.

Any input very much appreciated.
Alan





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.