sql server - SSIS Lookup, create new records for no-match output and get newly generated keys -
i have hotel table.
create table dimhotel ( hotel_id int identity(1, 1), hotelname nvarchar(max) )
now feeds hotelnames
, our business logic use hotel_id
existing hotelname , create new record hotelname new , use newly generated hotel_id. understood can direct "lookup no match output" ole db command transformation how newly generated key. 1 option 1 more lookup on dimhotel table (i guess stupid, scanning table twice). other option have.
i can use merge statement our etl team wants avoid hand coding.
i think better use stored procedure retrieves scope_identity output parameter .
example :-
create procedure ( column names , @id int ) begin insert tablename values (@col1) select @id = scope_identity() end
Comments
Post a Comment