Regarding:
I set up the sp stated first in the first part with no problems. However, when I try creating the second sp, I'm getting syntax errors.
This is the error I get
Error 170: Line 10: Incorrect syntax near '+'.
Line 13: Incorrect syntax near 'RAISEERROR'.
I can't figure out why it's erroring out on the concatenation.
I set up the sp stated first in the first part with no problems. However, when I try creating the second sp, I'm getting syntax errors.
Code:
CREATE PROCEDURE spNewAnswer
--String data that will become part of dynamic SQL statement.
@UserInput1 AS varchar(8000),
@UserInput2 AS varchar(8000),
@wAnswer varchar(255)
AS
DECLARE @BadKeywords AS varchar(8000)
--Be sure to place a space between each parameter to be tested.
EXEC spInjectionAttack
@UserInput1 + ' ' + @UserInput2,
@BadKeywords OUTPUT
IF Len(@BadKeywords)>0 BEGIN
RAISEERROR ('Possible SQL injection attack:'
+Char(13)+@BadKeywords,15,-1)
RETURN
END
DECLARE @KEY int
INSERT INTO tblSurveyAnswers (svaAnswers)
VALUES
(
@wAnswer
)
SELECT @KEY = @@IDENTITY
SELECT svaUID, svaAnswers from tblSurveyAnswers WHERE svaUID = @KEY
GO
This is the error I get
Error 170: Line 10: Incorrect syntax near '+'.
Line 13: Incorrect syntax near 'RAISEERROR'.
I can't figure out why it's erroring out on the concatenation.