我想在 x 行中将我的身份添加到另一列。我可以在我的存储过程中使用此代码重复两行。
ALTER PROCEDURE [dbo].[InsertReport3] @incdate INT,
@inctime VARCHAR(7),
@inv1 VARCHAR(30),
@inv2 VARCHAR(30),
@inv3 VARCHAR(30),
@inctype VARCHAR(20),
@incnar TEXT,
@incloc TEXT,
@no INT
AS
INSERT INTO IncidentReport
(I_Date_Incident,
I_Time,
IncidentType,
I_Narrative,
I_Location,
I_ID,
U_no_fk)
VALUES (@incdate,
@inctime,
@inctype,
@incnar,
@incloc,
@inv1,
@no);
UPDATE Incidentreport
SET I_reportno = @@IDENTITY
WHERE I_no = @@IDENTITY;
INSERT INTO IncidentReport
(I_reportno,
I_Date_Incident,
I_Time,
IncidentType,
I_Narrative,
I_Location,
I_ID,
U_no_fk)
VALUES (@@IDENTITY,
@incdate,
@inctime,
@inctype,
@incnar,
@incloc,
@inv2,
@no);
一旦我使用该代码达到三个它会增加一个,只拉出以前的身份,想法?