SQLTeam.com | Weblogs | Forums

Need CASE WHEN help


#1

Can't seem to get the syntax right ....ugh! This is being used to build an XML file in case one wonders.

CASE A0600A WHEN '000000000' THEN '^' ELSE CASE A0600A IS NULL THEN '^' ELSE CASE A0600A WHEN '' THEN '^' ELSE A0600A END END END

If A0600A is "000000000", is null, or is blank then I want a '^' otherwise what ever the value of A0600A.

A0600A is a VARCHAR data type by the way.


#2

Like this:

CASE 
	WHEN A0600A IS NULL OR A0600A = '000000000' OR A0600A = '' THEN '^'
	ELSE A0600A
END

#3

case when A0600A = '000000000' or A0600A is null or A0600A = '' then '^'
else A0600A
end

Need the sniped icon!


#4

:sniped:

Press colon and start typing the first letters (sn...) and you will see it. Took Graz explaining it to me in detail for me to figure that out!!


#5

Thank you both!! That did it.