Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select with Case
Message
From
08/10/2007 15:25:19
Issam Mansour
Jordan Business Machines
Amman, Jordan
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Select with Case
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01259547
Message ID:
01259547
Views:
55
This is my first time using case statement; I am tried to case the value of a field on a select statement as follows:

SELECT #f.catcode,
#f.subcode,
'' AS sercode,
'' AS ITEMNO,
CASE LEN(#f.SubCode)
WHEN 0 THEN #f.CatCode
ELSE #f.CatCode + #f.SubCode
END AS ITEM_NO,
CASE LEN(#f.SubCode)
WHEN 0 THEN ''
ELSE #f.SubCode
END AS FATHER,
CASE LEN(#f.SubCode)
WHEN 0 THEN category.catdesc
ELSE category.catdesc
END AS ITEMDESC,
'' AS UNIT,
0 AS PIECES,
0 AS qoh,
0 as lastone
into #cur1
FROM #f inner join category on #f.catcode = category.catcode or #f.subcode = category.subcode

I have an error message as follows:
Invalid object name 'category'.

Can anyone help me with this?

Best Regards
Next
Reply
Map
View

Click here to load this message in the networking platform