t-sql,sql server 2000

  • I have 2 tables

    A and B

    Table A columns:

    Name -nvarchar

    ID1 -nvarchar

    ID2 -nvarchar

    CatID -int

    Table B(ID(primary key(Is identity)),Id_AB(FK),col6,col7,col8,col9,col10)

    Id - int ,not null

    id_ab - int ,null

    col5 -nvarchar

    col6 -nvarchar

    col7 -bit,null

    col8 -bit,null

    col9 -bit,null

    col10 -nvarchar

    The table already has around 10000+ rows.

    But i now I have a situation where for every new row in table A

    with ID1 having

    a new value say '12' and ID2 having a new value '14'

    I need to insert 4 new rows

    in Table B with 4 new rows as below

    I need to insert 4 new rows in table B with values :

    1st row----

    (Id -incremental value

    id_ab - 1

    col5 - will have ID1 value

    col6- will have Name value

    col7 -will have True

    col8 -will have True

    col9 -will have True

    col10 -will have ABC.mdb)

    ------

    2nd row -

    (Id -incremental value

    id_ab - 2

    col5 - will have ID1 value

    col6- will have Name value

    col7 -will have True

    col8 -will have True

    col9 -will have True

    col10 -will have ABC.mdb)

    ----

    3rd row-

    (Id -incremental value

    id_ab - 1

    col5 - will have ID2 value

    col6- will have Name value

    col7 -will have True

    col8 -will have True

    col9 -will have True

    col10 -will have ABC.mdb)

    ----

    4th row

    (Id -incremental value

    id_ab - 2

    col5 - will have ID2 value

    col6- will have Name value

    col7 -will have True

    col8 -will have True

    col9 -will have True

    col10 -will have ABC.mdb)

  • Please don't cross post. It just wastes peoples time and fragments replies.

    No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic1238996-8-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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