aruba
Programmer
- Sep 5, 2003
- 47
Can anyone tell me why the following view doesn't work? The SELECT statements work fine on their own, but they won't work when I add the IF statement. Thanks to anyone who can solve my problem!
ALTER VIEW WKCTL.V_P3_BACKLOGS
AS
IF substring(ACT,3,1) in ('A','B','C','D','E','F','G','H','J','K')
SELECT CONVERT(numeric(9), WKCTL.scrub_numbers(SUBSTRING(WKCTL.Act_convertToPP(ACT), 3, 7) + CONVERT(VARCHAR(2),
WKCTL.scrub_numbers(SUBSTRING (ACT, 10, 2))))) AS PARENTWO, SUBSTRING(WKCTL.Act_convertToPP(ACT), 1, 2)
AS P3_BACKLOG
FROM WKCTL.P3ACTBBOP
WHERE (SCOP NOT LIKE '%M%')
ELSE
SELECT convert(numeric(9),WKCTL.SCRUB_NUMBERS( substring(ACT, 3, 6)
+ convert(varchar(2), WKCTL.SCRUB_NUMBERS(substring(ACT, 9, 2))))) PARENTWO,
substring(ACT, 1, 2) P3_BACKLOG
FROM WKCTL.P3ACTBBOP
WHERE SCOP NOT LIKE '%M%'
GO
ALTER VIEW WKCTL.V_P3_BACKLOGS
AS
IF substring(ACT,3,1) in ('A','B','C','D','E','F','G','H','J','K')
SELECT CONVERT(numeric(9), WKCTL.scrub_numbers(SUBSTRING(WKCTL.Act_convertToPP(ACT), 3, 7) + CONVERT(VARCHAR(2),
WKCTL.scrub_numbers(SUBSTRING (ACT, 10, 2))))) AS PARENTWO, SUBSTRING(WKCTL.Act_convertToPP(ACT), 1, 2)
AS P3_BACKLOG
FROM WKCTL.P3ACTBBOP
WHERE (SCOP NOT LIKE '%M%')
ELSE
SELECT convert(numeric(9),WKCTL.SCRUB_NUMBERS( substring(ACT, 3, 6)
+ convert(varchar(2), WKCTL.SCRUB_NUMBERS(substring(ACT, 9, 2))))) PARENTWO,
substring(ACT, 1, 2) P3_BACKLOG
FROM WKCTL.P3ACTBBOP
WHERE SCOP NOT LIKE '%M%'
GO