index table variable

  • I have created a table variable

    DECLARE @tblDataLogTraceRawDataTemp TABLE(

    [DataLoggerTraceID] [bigint] NOT NULL,

    [ReadingDateTime] [datetime] NOT NULL,

    [TonneRate] [decimal](18, 5) NULL,

    [Tonnes] [decimal](18, 0) NULL,

    [LoadID] [bigint] NULL

    )

    How do i place an index on the DataLoggerTraceID and ReadingDateTime columns?

  • The only index you can put on a table variable, is a Primary Key.

    --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)
    Intro to Tally Tables and Functions

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

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