Ensure Table has only one row

  • Comments posted to this topic are about the item Ensure Table has only one row

  • Sometimes I want to keep a "history" of the different settings, or have more than one set depending on circumstances. In these cases, I use a "current" column (bit) to determine which row I should be using. Just for info.

  • An alternate method to insure only one row (or 2, 3, ... rows) would be to simply define a unique key and check constraint on the table's ID column.

    create table tempdb..foo

    (

    foo_id int not null primary key check (foo_id = 1)

    );

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Stephen_W_Dodd (12/8/2011)


    Sometimes I want to keep a "history" of the different settings, or have more than one set depending on circumstances. In these cases, I use a "current" column (bit) to determine which row I should be using. Just for info.

    Thanks for the tip.

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

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