Home Forums SQL Server 2005 Backups help with best practice for merging 2 sql databases RE: help with best practice for merging 2 sql databases

  • the order issue is the small problem

    the problem is that i have table "tbl_users" (code(index), firstname, email)

    and table "tbl_priceoffers" (code(index), usercode(from tbl_users), price)

    and it cannot insert "tbl_priceoffers" row without having @@identity from the recently inserted "tbl_users" row

    basically the solution suppose to be something like :

    to loop all missing users/priceoffers and :

    insert into tbl_users (firstname email) select 'firstname','email'

    set @code=select @@identity

    insert into tbl_priceoffers (usercode, price) select @code, 100

    it seems like i'm answering my question right here but i'm not sure that is the right solution..