Click here to Skip to main content
15,923,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CREATE PROCEDURE dbo.insert


@name varchar(50),
@address varchar(50)


AS
insert into info (name,address) values (@name,@address);
RETURN





ERROR:


Incorect syntext near the keyword insert


must declare the table variable "@name"
must declare the scalar variable "@name"
Posted

INSERT [^]is a SQL Keyword. It can't be name of your stored procedure.

Change it to InsertData or something.
 
Share this answer
 
v2
Comments
Dholakiya Ankit 9-Aug-13 23:23pm    
yes nice one 5ed
Hello

U can use insert keyword also but to put insert keyword into Bracket like below
[Insert],
Try it.

Thanks
 
Share this answer
 
Hello

make sure your code has the same variables as your storedprocedure like:

C#
cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar, 50));
               cmd.Parameters["@name"].Value = fname;


C#
cmd.Parameters.Add(new SqlParameter("@address", SqlDbType.NVarChar, 50));
               cmd.Parameters["@address"].Value = address;





hope it helps...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900