Subject | Re: case when .. else ..end |
---|---|
Author | polash26 |
Post date | 2005-10-19T11:16:51Z |
ERROR:
/**************
The next statement causes the following error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 11, char 8.
when.
*********************************/
I tried following way
FOR SELECT
MP.RoleID,
case
when MP.RoleID = -1 then 'All Users'
when MP.RoleID = -2 then 'Superuser'
when MP.RoleID = -3 then 'Unauthenticated Users'
else R.RoleName
end
FROM AAA MP
and also using double quote,
FOR SELECT
MP.RoleID,
case
when MP.RoleID = -1 then "All Users"
when MP.RoleID = -2 then "Superuser"
when MP.RoleID = -3 then "Unauthenticated Users"
else R.RoleName
end
FROM AAA MP
/**************
The next statement causes the following error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 11, char 8.
when.
*********************************/
I tried following way
FOR SELECT
MP.RoleID,
case
when MP.RoleID = -1 then 'All Users'
when MP.RoleID = -2 then 'Superuser'
when MP.RoleID = -3 then 'Unauthenticated Users'
else R.RoleName
end
FROM AAA MP
and also using double quote,
FOR SELECT
MP.RoleID,
case
when MP.RoleID = -1 then "All Users"
when MP.RoleID = -2 then "Superuser"
when MP.RoleID = -3 then "Unauthenticated Users"
else R.RoleName
end
FROM AAA MP