Is Primary key necesary in the Detail Table

  • create table #demo

    (

     c1 int

     , c2 char

    )

    insert into #demo values(1,'a')

    insert into #demo values(1,'b')

    insert into #demo values(1,'a')

    select * from #demo

    update #demo set c2='z' where c2='b'

    select * from #demo

    drop table #demo

    c1          c2  

    ----------- ----

    1           a

    1           b

    1           a

    (3 row(s) affected)

    c1          c2  

    ----------- ----

    1           a

    1           z

    1           a

    (3 row(s) affected)

    Removing duplicates without a PRIMARY KEY will get very tricky, but UPDATE should work.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing post 16 (of 15 total)

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