My tables:
CRAFT TABLE
id
weeklyuid
craftname
wage
WAGERATE TABLE
id
craftid
plantid
wagerate
I have two tables craft and wagerates. I want to sort the craft table on the weeklyUID field and update all records that meet the sort criteria with a wage rate that is looked up in the wagerate table.
I'm trying to get the following stored procedure to work but I'm not having any luck:
How do you access two diffrent tables from a single stored procedure?
Dave
CRAFT TABLE
id
weeklyuid
craftname
wage
WAGERATE TABLE
id
craftid
plantid
wagerate
I have two tables craft and wagerates. I want to sort the craft table on the weeklyUID field and update all records that meet the sort criteria with a wage rate that is looked up in the wagerate table.
I'm trying to get the following stored procedure to work but I'm not having any luck:
Code:
CREATE PROCEDURE spUpdateWages
@wuid uniqueidentifier,
@plantid integer,
@craftid integer
AS
BEGIN
Update Craft2
set
craft2.wage = (select wagerate from wagerates where plantid = @plantid and craftid = @craftid)
where weeklyuid = @wuid
END
GO
How do you access two diffrent tables from a single stored procedure?
Dave