Click here to Skip to main content
15,908,673 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
CREATE PROCEDURE [SP_PersonelInfo]
	@[personelcode] varchar (20),
	@[firstname] nvarchar(50),
	@[lastname) nvarchar(50),
	@[FK_pID] int,
	@[employmenttype] nvarchar(50),
	@[employmentdate] char(10)
begin
	insert into PersonelInfo(PersonelCode,FirstName,LastName)
	Values([personelcode],[firstname],[lastname])
DECLARE @lstprsnlID INT
set @lstprsnlID = SCOPE_IDENTITY();

	insert into EmploymentInfo(FK_pID,EmploymentType,EmploymentDate)
        Values([lstprsnlID],[employmenttype],[employmentdate])
END
go

the error is on this part:varchar (20)
and the error text is: "Incorrect syntax near '20'. Expecting SELECT, or '('"

and you can see error picture here:
<a href="http://i44.tinypic.com/v5a79d.png">error</a>
Posted
Updated 26-Jan-14 21:17pm
v5
Comments
thatraja 27-Jan-14 2:45am    
Include the error message in your question
thatraja 27-Jan-14 2:56am    
Some URLs not working(blocked) for some of us. That's why I'm asking the error message in text.

Or use hosts like imgur.com to upload images
OriginalGriff 27-Jan-14 3:05am    
No, I'm not going to go to an unknown site, and download an unknown file, from a total stranger.
Why would I? Does an error message need a picture? No - it's just you are too lazy to copy and paste...
If you want help, then make it as simple as possible for us to give that help: edit your question and include the error message.
Help us to help you!

Use the "Improve question" widget to edit your question and provide better information.
Member 10454499 27-Jan-14 7:20am    
Why don't you use varchar instead of nvarchar, its save memory
OriginalGriff 27-Jan-14 8:29am    
Unicode, probably.

CREATE PROCEDURE [SP_PersonelInfo](
	@personelcode varchar(20),
	@firstname nvarchar(50),
	@lastname nvarchar(50),
	@FK_pID int,
	@employmenttype nvarchar(50),
	@employmentdate char(10))
	as 
	set nocount on
begin
	insert into PersonelInfo(PersonelCode,FirstName,LastName)
	Values(@personelcode,@firstname,@lastname)
DECLARE @lstprsnlID INT
set @lstprsnlID = SCOPE_IDENTITY();
 
	insert into PersonelInfo(FK_pID,EmploymentType,EmploymentDate)
        Values(@lstprsnlID,@employmenttype,@employmentdate)
END
set nocount off
 
Share this answer
 
Remove all your brackets!!!

SQL
CREATE PROCEDURE [SP_PersonelInfo]
    @personelcode varchar (20),
    @firstname nvarchar(50),
    @lastname nvarchar(50),
    @FK_pID int,
    @employmenttype nvarchar(50),
    @employmentdate char(10)
 
Share this answer
 
Comments
mit62 27-Jan-14 3:21am    
thanks.
hi.remove bracket from your paramters.
 
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