INSERT INTO...

Posts   
 
    
softwarea
User
Posts: 57
Joined: 05-Mar-2007
# Posted on: 21-Sep-2007 10:59:08   

Hi guys,

again I'm running in a problem which I can't solve without your help.

INSERT INTO tempResult (tmp_Cus_id)
    SELECT DISTINCT Cus_ID
    FROM dbo.Customer
    WHERE Cus_Status = "OK" 

My questions are:

  • How can I formulate an INSERT INTO statement like the above with LLBL means? A piece of code would be very nice.
  • Is the LLBL performance of the corresponding code (see 1.) comparable to the original sql statement? I have to insert approximately 10.000 datarows...in fact I could just use the given sql statement, but I would prefer to use LLBL generated code because of way better handling. I'm using LLBL 2.0, SelfService and MS SQL 2005.

Thank you! Ingmar

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Sep-2007 11:22:13   

Insert Into is not supported.

You can fetch entities from the customer table, and then project them into another entity or dataStructure where they can be saved to the tmp table.

Is the LLBL performance of the corresponding code (see 1.) comparable to the original sql statement?

I didn't understand thsi question.

softwarea
User
Posts: 57
Joined: 05-Mar-2007
# Posted on: 21-Sep-2007 11:31:32   

Ok, thanks, I was just wondering if I missed something.

Concerning the second question: I assume that executing the original sql statement directly on the database is the fastest way to add tousands of new rows to a table. I just wanted to make sure that the LLBL generated code would not add every entity separately, but in one chunk (so not loosing to much time compared to the direct approach). Anyway, it doesn't matter anymore, because INSERT INTO is not supportted yet, as you said.

Thanks, Ingmar

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Sep-2007 11:41:22   

Doing bulk inserts is always better using direct database approaches.