• GilaMonster (10/12/2015)


    Be careful with table variables, because they don't have statistics

    Not quite true.

    They do not have statistics only if you have not created them.

    But this table variable will have stats:

    DECLARE @Table TABLE (

    SerialNumber nvarchar(30),

    Reference nvarchar(50),

    PRIMARY KEY (SerialNumber),

    UNIQUE (Reference)

    )

    _____________
    Code for TallyGenerator