Microsoft
Software
Hardware
Network
Question : COALESCE and AS with CASE WHEN statment, other ways?
Can't figure out if this is the only way to achieve wanted result. Probably not...i hope, but im stuck.
In a data retrival stored procedure i provide an integer that determines if some information should be hidden in query. A user might have the right to see scheduled item but not the information is scheduled for.
The information is an COALESCE as it has various of information to show due to joins. The only way I have come up with is the following:
R.ResourceText+', '+
COALESCE( CASE
WHEN ( RS.CreatedBy_SystemCompany
_ID_FK = @syscompid
OR
RS.UpdatedBy_SystemCompany
_ID_FK = @syscompid
OR
INV.CreatedBy_SystemCompan
y_ID_FK = @syscompid
OR
PER.CreatedBy_SystemCompan
y_ID_FK = @syscompid
OR
PRO.CreatedBy_SystemCompan
y_ID_FK = @syscompid
) THEN null ELSE ' | INFORMATION UNAVAILABLE |'
END,
FE.Feed_Title+' ('+FT.FeedType_Title+')',
FE.Feed_Title,
WO.WorkOrder_Title,
EV.EventFlowOrder_Title,
RS.ResourceSchedule_Title + ' | '+RS.ResourceSchedule_Desc
ription,
RS.ResourceSchedule_Title,
'not found' ) as RSTitle
Isn't there a smarter syntax or way? In above case I would have to use the CASE statement in all COALESCE's that needs information to be hidden.
Thanks in advance.
Answer : COALESCE and AS with CASE WHEN statment, other ways?
Yes that's what I meant.
In my opinion a function should increase performance however that's not always the case.
It's just a matter of trying.
Random Solutions
document.MediaPlayer.curre<wbr />ntPosition<wbr /> returns "undefined" in firefox but works fine in IE
How to set mailbox quota for sendmail
Exchange 2007 - users no longer receive Delivery Status Notification (Relay) when sending messages with delivery receipt to external addresses
XP Administrator/limited account
to sort log files by date
changing password
Overwrite existing default SMTP certificate on Exchange 2007
How to bypass admin password for vista business?
Corrupted Outlook archive.pst file
Recover Deleted Email - Exchange 2000