Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [ConferenceLast]
- GO
- /****** Object: StoredProcedure [dbo].[addPerson] Script Date: 21.01.2017 20:28:33 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[addEmployee]
- -- Add the parameters for the stored procedure here
- @company_id int,
- @name varchar(50),
- @title varchar(50)
- AS
- BEGIN
- BEGIN TRAN
- declare @CompanyAccountID int;
- declare @ParticipantId int;
- Select @CompanyAccountID = account_id
- From Company
- where id = @company_id;
- if @CompanyAccountID is not null
- begin
- insert into Participant(account_id) values (@CompanyAccountID)
- SET @ParticipantId = scope_identity();
- insert into Employee(name, company_id,participant_id,title)
- values (@name, @company_id, @ParticipantId, @title)
- end
- Commit TRAN
- END
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement