Reputation: 67
My code:
CREATE TABLE test (id INT NOT NULL PRIMARY KEY IDENTITY(1,1),
text VARCHAR(255)
);
GO
CREATE PROCEDURE testProc(@string VARCHAR(255))
AS
BEGIN
INSERT INTO test (text) VALUES (@string);
SELECT * FROM test;
END
GO
EXEC testProc('Test01')
The error I get after running it:
Incorrect syntax near 'Test01'.*
I want to insert 'Test01'
into my table test with the help of the proc testProc
, but it doesn't work.
Upvotes: 0
Views: 63
Reputation: 1493
You just need to omit the parentheses.
EXEC testProc @string = 'Test01';
Upvotes: 3