dbTalk Databases Forums  

SSIS - Retrieve Identity from DB-DataFlow Destination(ID after ins

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


Discuss SSIS - Retrieve Identity from DB-DataFlow Destination(ID after ins in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave L
 
Posts: n/a

Default SSIS - Retrieve Identity from DB-DataFlow Destination(ID after ins - 11-02-2005 , 08:18 PM






Is there an easy method to retrieve a identity value during/after a row is
inserted in the DB-Destination Task.

1) Retrieve record with custom and address combined
2) Extract address from customer and create address record
(need AddressID - Identity column) after the insert
3) Create customer record with the AddressID (identity column) from previous
step

I would hope do due this without having to do a lookup
(address1,address2,city,state,zip) by retrieving the identity column value as
the record is inserted.

thanks,



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: SSIS - Retrieve Identity from DB-DataFlow Destination(ID after ins - 11-03-2005 , 04:32 AM






There is no way to get IDENTITY Values like this. They way I work around
this is to assign the new row number prior to the insert. The logic goes
like this-

Exec SQL Task - SELECT MAX(IDCol) FROM Table - Store this in a variable.

Data Flow - Source - Row Number Transform - Destination

The Row Number transformation will accept a variable as the seed.

You will either remove the IDENTITY attribute from your base table, or turn
insert identity on.

Row Number Tranform is free from SQLIS (http://www.sqlis.com), or write your
own in a Script Component.

--
Darren Green
http://www.sqldts.com
http://www.sqlis.com


"Dave L" <DaveL (AT) discussions (DOT) microsoft.com> wrote

Quote:
Is there an easy method to retrieve a identity value during/after a row is
inserted in the DB-Destination Task.

1) Retrieve record with custom and address combined
2) Extract address from customer and create address record
(need AddressID - Identity column) after the insert
3) Create customer record with the AddressID (identity column) from
previous
step

I would hope do due this without having to do a lookup
(address1,address2,city,state,zip) by retrieving the identity column value
as
the record is inserted.

thanks,





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.