I am going to insert the table from temporary table
SELECT D.ID,D.NAME,D.VALUE,T.TOM_ID
* INTO #TEMP_TBL
FROM DOM D INNER JOIN TOM T
ON D.ID =T.ID
NOW I will insert this temp table records to another table COM(THIS TABLE HAVE IDENTITY FILED OF COM_ID)
INSERT INTO COM ( ID,NAME,VALUE ) FROM SELECT ID ,NAME, VALUE FROM #TEMP_TBL Now my requirement is I need to get inserted records identity values(com_id) and have to refer to other table
INSERT INTO TYPE
(
TYPE_ID,COM_ID,NAME,TOM_ID)
SELECT ID,COM_ID(FROM IDENTITY INSERTED IN ABOVE TABLE)NAME,TOM_ID FROM #TEMP_TBL
)
There is more than one record get inserted in every table.How to i find the inserted identity column and assigned this to other.
Aucun commentaire:
Enregistrer un commentaire