Home > DeveloperSection > Forums > auto increment by store procedure
Pawan kumar
Pawan kumar

Total Post:19

Points:133
Posted on    March-14-2011 8:38 PM

 MSSQL Server MSSQL Server 
Ratings:


 1 Reply(s)
 1743  View(s)
Rate this:

sir  i used this SP but Not autoincement

ALTER PROCEDURE dbo.AutoIncrement(@EmpName varchar(25),@Fathername varchar(25),@Address nvarchar(50),

@Phone nvarchar(12),

@Sex varchar(8),

@MaterialStatus varchar(10))

as

Declare @AEmpId int

select @AEmpId=count(EmpId)from TblEmpReg

IF(@AEmpId='0')

BEGIN

SET @AEmpId='1'

END

SELECT @AEmpId=max(@AEmpId)+1 FROM TblEmpReg

Insert into TblEmpReg(EmpId,EmpName,Fathername,Address,Phone,sex,MaterialStatus)values(@AEmpId,@EmpName,@Fathername,@Address,@Phone,@sex,@MaterialStatus)



Awadhendra Tiwari

Total Post:126

Points:882
Posted on    March-15-2011 9:18 AM


Don't want to miss updates? Please click the below button!

Follow MindStick