hi,
try this way,
--------
DECLARE @NIDTBL TABLE(NID INT);
DECLARE @NID INT;
BEGIN
INSERT A (
NAME,
AGE
)OUTPUT INSERTED.ID INTO @NIDTBL VALUES (
'X',
12
);
SELECT @NID= NID FROM @NIDTBL;
--SELECT @NID
INSERT INTO TABLE B (
ID,
ADDRESS,
[MARITAL STATUS],
) VALUES (
@NID,
'AT HOME',
'MARRIED',
) ;
END;
Tharindu Dhaneenja.
MCTS,MCITP(SQL Server),OCA(Oracle)
http://www.databaseusergroup.com