my stored procedure is as follows:
ALTER procedure [dbo].[spAllinone]
(
@event tinyint,
@Empid int Identity(1,1) PRIMARY KEY NOT NULL,
@Empname nvarchar(50)=null,
@Salary int=null,
@City nvarchar(50)=null
)
as
if @event = 1
begin
insert into employee_tab(Empname,Salary,City)
values (@Empname,@Salary,@City)
end
else if @event = 2
begin
update employee_tab
set Empname = @Empname,Salary = @Salary,City = @City
where (Empid = @Empid)
End
else if @event = 3
begin
delete from employee_tab
where (Empid = @Empid)
End
but when execute it ,it gives me error like this:
Msg 156, Level 15, State 1, Procedure spAllinone, Line 4
Incorrect syntax near the keyword 'Identity'.
Msg 137, Level 15, State 2, Procedure spAllinone, Line 14
Must declare the scalar variable "@Empname".
Msg 137, Level 15, State 2, Procedure spAllinone, Line 20
Must declare the scalar variable "@Empname".
Msg 137, Level 15, State 2, Procedure spAllinone, Line 27
Must declare the scalar variable "@Empid"
What i want is to auto increase the column Empid value. i have a web application on visual studio 2008 . i dont want to pass the Empid . only i want to pass Empname,Salary,City when performing insert operation.Thanks.