insert into with select

Posts   
 
    
Gabbo
User
Posts: 56
Joined: 12-Jun-2006
# Posted on: 14-Jun-2006 22:43:39   

Hi,

What's the best way to accomplish the following using the adapter?

declare @person_id int set @person_id = 2

declare @code_identifier varchar( 8 ) set @code_identifier = '12345678'

insert into sweepstakes ( person_id, sweestakes_code_id ) select @person_id, sweepstakes_code_id from sweepstakes_code where code_identifier = @code_identifier

I can use a SweepstakesCodeEntity instance to get the sweepstakes_code_id based on the @code_identifier value, and then just issue an adapter.SaveEntity( sweepstakes ) after setting the PersonId and SweepstakesCodeId properties of the sweepstakes object, but was wondering if there was a more direct way?

The relationship between the two tables is:

sweepstakes.sweepstakes_code_id = sweepstakes_code.sweepstakes_code_id

Thanks!

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 15-Jun-2006 00:02:59   

I don't believe there is any support for this in LLBLGen. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3281&HighLight=1