good evening everyone,
I have problem inserting record Header Table and Detail Table.
my Header Table Is given Below
CREATE TABLE [dbo].[TransactionHeader](
[TransactionKey] [int] IDENTITY(1,1) NOT NULL,
[TransactionType] [int] NULL,
[IntExternalFlag] [int] NULL,
[TransactionDate] [datetime] NULL,
CONSTRAINT [PK_TransactionHeader] PRIMARY KEY CLUSTERED
(
[TransactionKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
and Detail Table is Given Below.
CREATE TABLE [dbo].[TransactionDetail](
[DetailKey] [int] IDENTITY(1,1) NOT NULL,
[TransactionKey] [int] NOT NULL,
[AssetID] [int] NULL,
[LocationID] [int] NULL,
[EmployeeID] [int] NULL,
[SupplierID] [int] NULL,
[IssuedReceivedDate] [datetime] NULL,
[TransactionDate] [datetime] NULL,
CONSTRAINT [PK_TransactionDetail] PRIMARY KEY CLUSTERED
(
[DetailKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TransactionDetail] WITH CHECK ADD CONSTRAINT [FK_TransactionDetail_TransactionHeader] FOREIGN KEY([TransactionKey])
REFERENCES [dbo].[TransactionHeader] ([TransactionKey])
GO
I want To Create one Stored procedure which is insert the one Record into Header and Multiple Record In Details Table.
My transactionKey is automatically generated by identity specification property of table.
so please help me how can i create procedure ....................
please give me any example.
Thanks