Reputation: 37
CREATE PROCEDURE Customer
( FName varchar(20),LName varchar(20),Birthdate datetime,Email Nvarchar(20),Houseno varchar(20),Street varchar(20),City varchar(20),Country varchar(20),Pincode int,Phno varchar(13),Mobile varchar(13),CustomerId varchar(20),Password varchar(20),ConfirmPassword varchar(20))
AS
Begin
Insert into Registration values
(@FName,@LName,@Birthdate,@Email,@Houseno,@Street,@City,@Country,
@Pincode,@Phno, @Mobile,@CustomerId,@Password,@ConfirmPassword)
End
While saving error comes as
Fname must be declare as Scalar variable
Whats wrong with this code?
Upvotes: 4
Views: 716
Reputation: 5798
You must define your local variable as @local_variable, see MSDN
@local_variable Is the name of a variable. Variable names must begin with an at (@) sign. Local variable names must comply with the rules for
With @, it tell sqlserver that it is local variable. Also you define @ while insert.
As above all suggested, just add @ before each parameter name.
Upvotes: 0
Reputation: 3271
The variables you are trying to insert have not been declared correctly. You must prefix all of the declarations with @.
create procedure Customer
(@FName varchar(20),@LName varchar(20),@Birthdate datetime,@Email Nvarchar(20),@Houseno varchar(20),@Street varchar(20),@City varchar(20),@Country varchar(20),@Pincode int,@Phno varchar(13),@Mobile varchar(13),@CustomerId varchar(20),@Password varchar(20),@ConfirmPassword varchar(20))
AS
Begin
Insert into Registration values (@FName,@LName,@Birthdate,@Email,@Houseno,@Street,@City,@Country,@Pincode,@Phno,
@Mobile,@CustomerId,@Password,@ConfirmPassword)
End
Upvotes: 0
Reputation:
You are missing the "@"
sign for your parameter declarations.
create procedure Customer
@FName varchar(20),@LName varchar(20) .....
Upvotes: 3