SQL Server: Is it possible to insert into two tables at the same time?

后端 未结 11 1421
青春惊慌失措
青春惊慌失措 2020-11-22 16:22

My database contains three tables called Object_Table, Data_Table and Link_Table. The link table just contains two columns, the identi

11条回答
  •  感动是毒
    2020-11-22 17:06

    -- ================================================
    -- Template generated from Template Explorer using:
    -- Create Procedure (New Menu).SQL
    --
    -- Use the Specify Values for Template Parameters 
    -- command (Ctrl-Shift-M) to fill in the parameter 
    -- values below.
    --
    -- This block of comments will not be included in
    -- the definition of the procedure.
    -- ================================================
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    ALTER PROCEDURE InsetIntoTwoTable
    
    (
    @name nvarchar(50),
    @Email nvarchar(50)
    )
    
    AS
    BEGIN
    
        SET NOCOUNT ON;
    
    
        insert into dbo.info(name) values (@name)
        insert into dbo.login(Email) values (@Email)
    END
    GO
    

提交回复
热议问题