J
JJ297
how do I set up a stored procedure to insert into two tables. This is
what I have thus far...
I want the quesid from the QuesNAns table to go into the Requestors
table Getting an error message that I must declare the QuesID but
when I do it still does not work. Any suggestions?
CREATE procedure AddQuestion
@quesdate datetime,
@topicid int,
@questions varchar(1000)
AS
Set NOCOUNT ON
INSERT INTO QuesNAns
(quesdate,topicid, questions)
values
(@quesdate,
@topicid,
@questions)
SET NOCOUNT OFF
SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY]
INSERT INTO Requestors
(quesid)
values
(@quesid)
GO
what I have thus far...
I want the quesid from the QuesNAns table to go into the Requestors
table Getting an error message that I must declare the QuesID but
when I do it still does not work. Any suggestions?
CREATE procedure AddQuestion
@quesdate datetime,
@topicid int,
@questions varchar(1000)
AS
Set NOCOUNT ON
INSERT INTO QuesNAns
(quesdate,topicid, questions)
values
(@quesdate,
@topicid,
@questions)
SET NOCOUNT OFF
SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY]
INSERT INTO Requestors
(quesid)
values
(@quesid)
GO