DataType Table or TempTable Which is Best?

  • Hi Guys,

    I Just wanted to know the difference between the below two tables which one should i prefer to use in procedure(s)?

    DECLARE @SelectDevicesTable table (

    RowId bigint IDENTITY (1, 1) NOT NULL

    ,sDeviceRegId varchar(20))

    OR

    CREATE TABLE #SelectDevicesTable (

    RowId bigint IDENTITY (1, 1) NOT NULL

    ,sDeviceRegId varchar(20))

    Please if possible provide some articles for further studies

    Thanks

    Patel Mohamad

  • This great article[/url] by Waye Sheffield will help you.

    Regards,

    Gianluca

    -- Gianluca Sartori

  • Thanks Gianluca Sartori

    Patel Mohamad

  • You're welcome.

    You will find lots of good articles here at SQL Server Central. When you want to know more on a particular subject, try searching the articles and I'm sure lots of great stuff will come up.

    -- Gianluca Sartori

  • Gianluca Sartori (9/30/2011)


    This great article[/url] by Waye Sheffield will help you.

    Regards,

    Gianluca

    Agreed... it's one of the better articles on Table Variable v.s. Temp Tables that I've ever seen.

    --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)

Viewing 5 posts - 1 through 4 (of 4 total)

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