开发者社区> 问答> 正文

在发送表ID中的两个表中插入数据时,不插入,但在我插入数据时,第二个表ID应从第一个表中插入

Create Procedure Sp_instAdminmaster] 
(@Name varchar(20),@FatherName varchar(20),@Email_Id varchar(20),@Address nvarchar(100),@City varchar(20),@State varchar(20),@Qualification varchar(30),@contactNo varchar(10),@Date date,
    @Remarks varchar(150),@Type varchar(20),@Fee money,@ClassName nvarchar(20),@Yearly money,@Halfyearly1 money,
    @Halfyearly2 money,@Quaterly1 money,@Quaterly2 money,@Quaterly3 money,@Quaterly4 money,@January money,
    @February money,@March money,@April money,@May money,@June money,@July money,
    @August money,@September money,@October money,@November money,@December money)
        AS
BEGIN
Insert into AdmissionMaster(Name,FatherName,Email_Id,Address,City,State,Qualification,contactNo,Date,Remarks,Type,Fee,ClassName)
values (@Name,@FatherName,@Email_Id,@Address,@City,@State,@Qualification,@contactNo,
    @Date,@Remarks,@Type,@Fee,@ClassName);
declare @Id int 
Select @Id as Id  from  AdmissionMaster 

insert into tblAdmissionDetails(Id,Yearly,Halfyearly1,Halfyearly2,Quaterly1,Quaterly2,Quaterly3,Quaterly4,
    January,February,March,April,May,June,July,August,September,October,November,December)
    values(@Id,@yearly,@Halfyearly1,@Halfyearly2,@Quaterly1,@Quaterly2,@Quaterly3,@Quaterly4,@January,@February,@March,
    @April,@May,@June,@July,@August,@September,@October,@November,@December)
END

展开
收起
祖安文状元 2020-01-05 14:49:16 442 0
1 条回答
写回答
取消 提交回答
  • 更改

    Select @Id as Id  from  AdmissionMaster
    
    

    SELECT @Id=IDENT_CURRENT('AdmissionMaster');
    
    2020-01-05 14:49:25
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载