Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 transaction problem

Author  Topic 

supermedo84@gmail.com
Starting Member

1 Post

Posted - 2008-08-02 : 10:11:24

i have two tables

*Project Table ---->Contian two columns ProID && Name
*ProjectEmployee Table ------->assigned employee for this project ----->contain two columns FK_ProID && FK_EmpID

i want to make transaction when update project update the ProjectEmployee Table

this information come from asp page and Employee come in the form of check list

i used stored procedure to call transaction

ok how can i make this transaction

mohamed samir abdeen

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-02 : 12:17:53
do you mean this?

CREATE PROC YourProc
@Employee varchar(50),
@Name varchar(50)

DECLARE @ProjID int,
@EmpID int
INSERT INTO Project (Name)
VALUES (@Name)

SELECT @ProjID=SCOPE_IDENTITY

INSERT INTO Employee (Name)
VALUES (@Employee)

SELECT @EmpID=SCOPE_IDENTITY

INSERT INTO ProjectEmployee
SELECT @ProjID,@EmpID
GO
Go to Top of Page
   

- Advertisement -