June 13, 2012

Insert Values Into Table Using Stored Procedure With Identity Column


 --First step is create Table empmaster with column empid,eno,ename etc  
 create table empmaster  
 (  
 empid int primary key identity,  
 eno int,  
 ename varchar  
 )  
 -- Now create Table empdetails with column empid,sal,dept, hiredate etc  
 create table empdetails  
 (  
 empid int ,  
 sal money,  
 dept varchar,  
 hiredate datetime  
 )  
 -- Now create Stored Procedure empvalues to insert records in tables  
 create proc empvalues  
 @eno int,  
 @ename varchar(20),  
 @sal money,  
 @dept varchar(20),  
 @hiredate datetime  
 as  
 begin  
 insert into empmaster .  
 INSERT INTO empdetails.   
 end