Your major error is in incorrect use of CASE syntax.
CASE input_expression
WHEN when_expression THEN result_expression [ ...n ]
[ ELSE else_result_expression ]
END
Don’t give to understand much what you are trying to do, but if you want the return to be 2 in the login of the value that is in TIPOUSUARIO
, you can use your case
in the select
thus.
USE DATABASE
SELECT case when TIPOUSUARIO = 'A' THEN '2' END
FROM TABLE UP (NOLOCK)
GO
Now if you want to use the case
in the where
would be.
USE DATABASE
SELECT TIPOUSUARIO
FROM TABLE UP (NOLOCK)
WHERE
TIPOUSUARIO = case when TIPOUSUARIO = 'A' THEN '2' END
GO
That would work if there was TIPOUSUARIO = 'A'
and TIPOUSUARIO = '2'
.
worked that way, thank you!
– hashtah29
show , marks as completed then hugs
– Jasar Orion