467,915 Members | 1,438 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

Whats wrong with my SQL code? HELP Please!!!

Hello
I am trying to get a table attribute to calculate the result of 2 attribute in another table. I am using SQL Server 2005. I got another table to do this and it works fine, but the only difference is is that the attributes are in the same table. My code is posted below but it does not Work. I get the message:

-------------------------------------------------------------------------
The multi-part identifier "ITEM_PURCHASE.LocalCurrencyAmt" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "ITEM_PURCHASE.ExchangeRate" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "ITEM_PURCHASE.LocalCurrencyAmt" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "ITEM_PURCHASE.ExchangeRate" could not be bound.
------------------------------------------------------------------------

CREATE TABLE WAREHOUSE(
ItemNumberSK int NOT NULL,
ItemName char(50) NOT NULL,
ItemUnitPrice as CASE
WHEN ITEM_PURCHASE.LocalCurrencyAmt > 0 AND ITEM_PURCHASE.ExchangeRate > 0 Then ITEM_PURCHASE.LocalCurrencyAmt * ITEM_PURCHASE.ExchangeRate * 1.2
END,
ItemQty numeric(7, 0) NOT NULL,
Nov 9 '08 #1
  • viewed: 1384
Share:
1 Reply
ck9663
Expert 2GB
I'm not sure if creating a check constraint like that is possible. Even if it's possible, I think it would be better if you use trigger to handle this.

-- CK
Nov 11 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Chris Geerdink | last post: by
4 posts views Thread by asdf | last post: by
5 posts views Thread by Alexandre Martins | last post: by
1 post views Thread by aa | last post: by
3 posts views Thread by mahsa | last post: by
4 posts views Thread by blah | last post: by
5 posts views Thread by islayer | last post: by
5 posts views Thread by hiqu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.