我有两张桌子。
1-学生表和2-分数表
我想在学生表中插入值并在带有 SP 的分数表中插入多个值到 SQL Server 2008。
对于 EX:
ALTER proc [dbo].[InsertIntoScore]
(
@DateReg datetime,
@stdLastName nvarchar(50),
@stdFirstName nvarchar(50),
@Description nvarchar(500),
multi value as score table...
)
AS
DECLARE @Id AS INT
BEGIN TRY
BEGIN TRANSACTION
INSERT INTO Student(DateReg,stdLastName,stdFirstName,[Description])
VALUES (@DateReg,@stdLastName,@stdFirstName,@Description)
set @Id = SCOPE_IDENTITY()
insert multi value at Score table...
COMMIT
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK
END CATCH
请帮我...