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
AS3 selectable text in a movieClip
Could you help me? ---- Where is the <a rel="nofollow" href="http://www.interland.com?" target="_blank">www.interland.com?</a>
Adding a second SQL 2005 Server for redundancy
Data Validation based on two values X and "Blank"
remove a macro from an excel sheet
Dropdown runs a query to populate checkboxes - ASP
Need assistance in growing my site traffic
"not enough quota" error on startup cant boot to OS even in safe mode!
Inactive Add-in
Copying item loses the workflow history