Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TSQL Error

Status
Not open for further replies.

MMund

Programmer
Oct 9, 2007
57
CA
Attempting to run the below code:

Code:
SET @lnDisEarn = 0
select @sumcur = sum(e.cur)
from py_ckearn e
join py_earn_rule f
on e.earn_rule_id = f.earn_rule_id
where f.cf_disearn = 1
--next query should only yield one record
select @cur = e.cur, @amtpct = f.amt_pct
from py_ckdeduct e
join py_deduct_rule f
on e.deduct_rule_id = f.deduct_rule_id
where f.deductcode = 514
--now accumulate lndisearn and calculate f_amount
SET @lnDisEarn = @lnDisEarn + @sumcur
set @f_amount = (@lnDisEarn*@amtpct/100)- @cur

and get the error:

The multi-part identifier "e.deduct_rule_id" could not be bound.

Any ideas what this means and what I can do about it?
 
That means you have no field <b>deduct_rule_id</b> named in <b>py_ckdeduct</b>

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP
 

One other possibility for what appened is:
If the colum value deduct_rule_id of the table py_deduct_rule does not have the same Type of the column
deduct_rule_id of the table py_deduct_rule...

We can oly match columns of the same type bigint with bigint and so on

One alternative is to go to design of one of the tables and change the type of the column
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top