Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Geting auto Generated ID of master of master table

Author  Topic 

tariq_erp
Starting Member

9 Posts

Posted - 2008-02-09 : 02:37:08
Hi All

While Insertion into three tables in a sequence M1, M2 ,M3 such that M1 is master table of M2 and M2 is master table of M2.

While insertion into M3 I need auto generated ID of M1.

Kindly suggest a way without using a variable for storage or (#,@) tables.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-09 : 02:44:02
Hope this is what you are after:-
INSERT INTO M1 VALUES (...)

INSERT INTO M2 VALUES....

INSERT INTO M3(M1IDfield,....)
VALUES (IDENT_CURRENT('M1'),....)
Go to Top of Page

tariq_erp
Starting Member

9 Posts

Posted - 2008-02-09 : 03:03:10
Thanx a lot dear It worked.
Go to Top of Page
   

- Advertisement -