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)
 Case error

Author  Topic 

wendy
Starting Member

19 Posts

Posted - 2006-04-13 : 16:14:04
Hi,

After I changed the “P.bu_id = CASE WHEN O.bu_id = '1-2Y3' OR O.bu_id = '1-2XR' THEN '1-TKA1N' ELSE O.bu_id END” To “CASE WHEN O.bu_id = '1-2Y3' OR O.bu_id = '1-2XR' THEN P.bu_id in ('1-TKA1N','1-72LTOE') ELSE P.bu_id = O.bu_id END” at the following query, I got invalid table error. Any one has the idea about what’s wrong, any help will be appreciated.
.
Select C.row_id as contact, T.row_id as ID, T.name as Territory
from Siebel.s_contact C, Siebel.s_org_ext O, Siebel.s_asgn_grp T
where C.pr_dept_ou_id = O.row_id
and C.row_id in
(Select par_row_id from Siebel.s_contact_xm
where name = 'Course.com'
and type = 'IA'
and attrib_46 = 'Active')
and (C.csn is NULL or C.csn = 'Active')
and O.par_ou_id is NULL
and T.pr_postn_id in
(Select row_id
from Siebel.s_postn P
where row_id in
(Select position_id from Siebel.s_accnt_postn
where ou_ext_id = O.row_id)
and CASE WHEN O.bu_id = '1-2Y3' OR O.bu_id = '1-2XR' THEN P.bu_id in ('1-TKA1N','1-72LTOE') ELSE P.bu_id = O.bu_id END
and P.bu_id <> P.ou_id)


Thanks

Wendy

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-04-13 : 16:18:07
If u can tell us what u want to do by the following :

... THEN P.bu_id in ('1-TKA1N','1-72LTOE') ....

V may be able to help

Srinika
Go to Top of Page

wendy
Starting Member

19 Posts

Posted - 2006-04-13 : 16:25:13
When the O.bu_id = '1-2Y3' OR O.bu_id = '1-2XR', the P.bu_id has to be either '1-TKA1N' or '1-72LTOE'.

Thanks

Wendy
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-04-13 : 16:40:55
In a computer language there should not be any ambiguity
U have to tell specifically
when it has to be '1-TKA1N' and
when it has to be '1-72LTOE'

Computer just won't select it randomly

or if u want to assign those values depending on the value of O.bu_id being '1-2Y3' OR
'1-2XR', then u have to use 2 When statements


Srinika
Go to Top of Page
   

- Advertisement -