Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iif statement in SQL 2000 select statement
Message
 
 
To
24/04/2003 09:10:12
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00781060
Message ID:
00781080
Views:
24
There's no IIF() function in SQL Server. You would use CASE function instead.
...
CASE dbo.Made2ManageReport_v.antitip
WHEN 'R' THEN 'RIGHT'
WHEN 'L' THEN 'LEFT'
WHEN 'B' THEN 'BOTH'
ELSE 'NONE' END  AS AntiTip,
...
>Can this work?
>the values in dbo.Made2ManageReport_v.antitip are R, L, B, N for right,
>left, both, and none.
>If this works can I use a case statement in a SQL statement.
>SELECT
>	dbo.Made2ManageReport_v.fsono AS SalesOrderNumber,
> 	dbo.Made2ManageReport_v.carriagetype,
>	dbo.Made2ManageReport_v.angle,
>    	dbo.Made2ManageReport_v.channel,
>  	dbo.Made2ManageReport_v.vendor,
>  	dbo.Made2ManageReport_v.sections,
>    	dbo.Made2ManageReport_v.passthrough,
>  	dbo.Made2ManageReport_v.starter,
>  	dbo.Made2ManageReport_v.adder,
>    	dbo.Made2ManageReport_v.standar,
>  	dbo.Made2ManageReport_v.xright,
>=====>  IIF(dbo.Made2ManageReport_v.antitip="R","RIGHT","LEFT") AS AntiTip,
>  	dbo.Made2ManageReport_v.fcustpono,
>  	dbo.Made2ManageReport_v.fenumber,
>  	dbo.Made2ManageReport_v.fduedate,
>  	dbo.Made2ManageReport_v.fbompart,
>	dbo.Made2ManageReport_v.fbomdesc AS Shaft
>FROM
>	dbo.Made2ManageReport_v
>LEFT OUTER JOIN
>    dbo.Shaft ON dbo.Made2ManageReport_v.fsono = dbo.Shaft.fsono
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform