-1
Good morning.
How do I make a SE function in SQL server?
For example, I have data in a column and when it is = '1';'masculino';'feminino'
.
You can help me please?
-1
Good morning.
How do I make a SE function in SQL server?
For example, I have data in a column and when it is = '1';'masculino';'feminino'
.
You can help me please?
1
In this case, the ideal is for you to use the CASE, since the return depends on the data validation of a specific field:
SELECT CASE WHEN campo_genero = '1' THEN 'Masculino' ELSE 'Feminino' END
FROM nome_tabela
Perfect rLinhares. Thanks, abs.
Browser other questions tagged sql sql-server
You are not signed in. Login or sign up in order to post.
The claudia
WHERE
serves or needs the same if?– rray
thus
– rLinhares
You know, how I would do that in the code?
– Maikol Oliveira
select case WHEN a.genero = '1' then 'Male' Else 'Female' end as genero from table
– Reginaldo Rigo
One option is the IIF() function, if the SQL Server version is 2012 or later.
– José Diz