• JosephDMarsh (2/5/2010)


    I chose 4, but (as it turns out) I was guessing. (I thought I knew what was going on, chose an answer and clicked 'Submit' before actually studying the question -- yes, that's a problem I'm working on)

    After re-reading the explanation, as well as all of the posts in this thread, I'm not clear on what is happening exactly.

    As a Rookie, this is what I *think* is happening:

    1. Temp table is created

    2. 10 records are created in temp table

    3. 4 More records are added to temp table (first part of @sql_str)

    4. All records are deleted from temp table (second part of @sql_str)

    Obviously, that is not the case. I can't find anything in BOL to help figger this out. Any help?

    Thanks in advance,

    - Joseph Marsh

    Some corrections:

    3. 4 rows selected and save somewhere in SQL buffer as a result set

    4. All records are deleted from temp table (second part of @sql_str)

    5. 4 rows from result set generated on step 3 re-inserted (as a result of D-SQL batch execution)

    To understand it better just imagine that D-SQL is executed as a Stored Procedure (or could be)

    insert into <table>

    exec <SP with 2 statements>

    Regards,

    Gennadiy