Querying a Table Using Dynamic SQL

  • twin.devil (7/7/2014)


    Jeff, Actually OP is using (*) when in the select statement something like this

    Select IDENTITY(INT,1,1) AS RowID, *

    into SomeTable

    From Table

    When we use this as the rule of thumb, identity column will be inherit, So only one identity column per table rule violates.

    I would suggested OP to use Actual Column Name List and could skipped the identity column, but as he need the 'Actual values', i think ROW_NUMBER() Function will do.

    That's precisely why I didn't use SELECT *.:-)

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • yeah i really hurt when you use it in a view. Its a nightmare :hehe:

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply