May 18, 2010 at 12:12 am
what am i missing...
update R
set WorkType = case when WorkTypeID in(4,5,6) AND
UPPER(OPNumber) LIKE '%S' AND UPPER(OPNumber) NOT LIKE 'GS%S'
then 'SSR Enhancements' else if
WorkTypeID in(4,5,6) AND
((UPPER(OPNumber) LIKE '%U' AND UPPER(OPNumber) NOT LIKE 'GS%U')
OR
(UPPER(OPNumber) LIKE '%P' AND UPPER(OPNumber) NOT LIKE 'GS%P'))
then 'Application Support' else if
WorkTypeID in(4,5,6) AND
UPPER(OPNumber) LIKE 'GS%' AND UPPER(OPNumber) NOT LIKE 'GS450A'
then 'General Support' else if
WorkTypeID in (1,2,3,4,5,6,7,8,9) AND
LEN(OPNumber)=6 AND ISNUMERIC(OPNumber)=1 AND OPNumber <>'999999'
then 'Project' else if
WorkTypeID in (1,2,3,4,5,6,7,8,9) AND OPNumber = '999998'
then 'Absence' else if
WorkTypeID =7 AND ((OPNumber = '999999') OR (UPPER(OPNumber) = 'GS450A'))
then 'Non-Billable'
end,
from xyz R
its throwing incorrect syntax error...i think am exhausted...need help...
May 18, 2010 at 12:21 am
NewBee, replace all of your ELSE IF to WHEN.. That syntax u used is not supported..
Hope this helps you!
May 18, 2010 at 12:24 am
To learn more about the CASE syntax, please go through the following BOL link, especially the Examples part of it
😎
May 18, 2010 at 12:28 am
May 18, 2010 at 12:34 am
update R
set WorkType = case
when WorkTypeID in(4,5,6) AND UPPER(OPNumber) LIKE '%S' AND UPPER(OPNumber) NOT LIKE 'GS%S' then 'SSR Enhancements'
when WorkTypeID in(4,5,6) AND ((UPPER(OPNumber) LIKE '%U' AND UPPER(OPNumber) NOT LIKE 'GS%U') OR (UPPER(OPNumber) LIKE '%P' AND UPPER(OPNumber) NOT LIKE 'GS%P')) then 'Application Support'
when WorkTypeID in(4,5,6) AND UPPER(OPNumber) LIKE 'GS%' AND UPPER(OPNumber) NOT LIKE 'GS450A' then 'General Support'
when WorkTypeID in (1,2,3,4,5,6,7,8,9) AND LEN(OPNumber)=6 AND ISNUMERIC(OPNumber)=1 AND OPNumber <>'999999' then 'Project'
when WorkTypeID in (1,2,3,4,5,6,7,8,9) AND OPNumber = '999998' then 'Absence'
when WorkTypeID =7 AND ((OPNumber = '999999') OR (UPPER(OPNumber) = 'GS450A')) then 'Non-Billable'
end
from xyz R
May 18, 2010 at 2:09 am
You're welcome, NewBee..:-)
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply