Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I'm trying to figure out how to convert this Access IIF statement to a SQL case statement:
IIf([TableA].[Name]="A","A","B" & IIf(IsNull([TableA].[Name2]),"No Name","")) & IIf([TableB].[Amount]="0","0","1") AS columnName,
Not sure how to integrate the ANDs into this. You can't do CASE THEN WHEN ELSE AND CASE THEN WHEN ELSE. Any help or pointers would be appreciated.
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts
Posted - 2011-04-14 : 12:26:41
Duplicate posthttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=159474==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
sharona
Yak Posting Veteran
75 Posts
Posted - 2011-04-15 : 09:59:52
case when [TableA].[Name]in ('A','A','B') then ????when ([TableA].[Name2] is null then 'No Name'when [TableB].[Amount]in (0,0,1) then ????end AS columnName,