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 2000 Forums
 SQL Server Development (2000)
 Update Multiple Tables

Author  Topic 

dprichard
Yak Posting Veteran

94 Posts

Posted - 2006-10-11 : 13:07:58
okay, another newbie update question. I really appreciate any help I can get on this. I think I have everything worked out here except for the request.processed.

I am updating the data in one table, but want to mark the records that I have udpated from the request table and changed the processed field from false to true. I am getting an error back:

Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "request.processed" could not be bound.


UPDATE emp_time_table
SET time_accrued = request.request_duration - emp_time_table.time_accrued, request.processed = 'True'
FROM request
INNER JOIN emp_time_table AS emp_time_table_1 ON request.emp_id = emp_time_table_1.emp_id
WHERE emp_time_table_1.to_type_id = request.time_off_id AND request.processed = 'False' AND request.request_time_taken = 'True'

dprichard
Yak Posting Veteran

94 Posts

Posted - 2006-10-11 : 13:26:33
Okay, I think I figured out that I have to split this off, but I am getting the wrong math now. If my request duration = 1 and my time accrued = 2 when I run this update, I get -1 as my answer where I think it should be just 1.

UPDATE emp_time_table
SET time_accrued = request.request_duration - emp_time_table_1.time_accrued
FROM request
INNER JOIN emp_time_table AS emp_time_table_1 ON request.emp_id = emp_time_table_1.emp_id
WHERE emp_time_table_1.to_type_id = request.time_off_id AND request.processed = 'False' AND request.requested_time_taken = 'True'
UPDATE request
SET request.processed = 'True'
WHERE request.requested_time_taken = 'True'

Go to Top of Page

dprichard
Yak Posting Veteran

94 Posts

Posted - 2006-10-11 : 13:27:13
Duh, nevermind.

Sorry about this waste of a post
Go to Top of Page
   

- Advertisement -