Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nested Case?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01298189
Message ID:
01298191
Vues:
27
There's another form of CASE statement.
	CASE 
		WHEN blocktype = 1 THEN 'Ind: '+blockDesc
		WHEN blocktype = 2 AND LEN(BlockTypeChar) = 0 THEN 'Grp' + BlockDesc
		ELSE 'Spec: '+BlockTypeChar 
	end as blockdesc,
>Anybody know how I can do this?
>
>
>
>
>    case blocktype
>             when 1 then 'Ind: '+blockDesc
>             when 2
>                 case blockTypeChar when ' ' then 'Grp: '+blockDesc else 'Spec: '+BlockTypeChar end as mytext
>	end as blockdesc,
>
>
>
>Here is the issue. I have a block type that will be 1 or 2, if it's 2, then the BlockTypeChar will either be blank or have a S.
>
>BlockType=1 then return 'Ind' + Block Desc
>BlockType=2 and BlockTypeChar = blank return 'Grp' + BlockDesc
>BlockType=3 and BlockTypeChar = 'S' return 'Spec' + BlockDesc
>
>Thanks
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform