SQL equivalent for IIf or Switch/case constructs
Questions tagged [case-expression]
34 questions
0
votes
1 answer
MySQL CASE expression error
I'm trying to create a function that returns a decimal value.
I'm new to MySQL. I have experience in MSSQL.
Here's the code.
delimiter $$
CREATE FUNCTION FN_SUELDO_BASICO(pLEGAJO_ID INT)
RETURNS decimal(12,2)
BEGIN
DECLARE…

leandronn
- 173
- 1
- 17
0
votes
1 answer
CASE WHEN THEN ELSE change to union?
I was wondering if it is possible to change a CASE when then else to a union all, or something like this.
I hope that it is possible ...
example
CASE WHEN(C.Salutation = 'Dhr.' OR C.salutation = 'dhr.')
THEN 'Meneer'+'…

Jeroen
- 269
- 2
- 3
- 13
-1
votes
2 answers
Querying SQL Server 2005 for certain XML values
I am trying to query XML columns in SQL Server 2005
I have a really long string which is stored in a column and it is XML. I want to check if the visibility of a certain item is set to true or not.
Any idea on how to do this?
I can't post the string…

jeffry
- 327
- 2
- 8
- 23
-3
votes
1 answer
SQL Server 2005: CASE statement question
I have 4 bit values and a varchar
sku
a
b
c
d
From a SELECT statement I need to get the following result for each bit value that has a value of 1.
So for each bit value I need to output its actual name, so the result would look like:
"NameOfSKU, a,…

Bill
- 1
- 1