1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| select *...
case when @Sort_1 = 4 then epp.epp_end_date else null end, /* #2012#-1 */
case when @Sort_1= 4 then isnull(prp.PRP_period_number, 0) else 1 end, /* #2012#-1 */
case when @Sort_1 = 1 then isnull(emc.emc_contract_number,'')
when @Sort_1 = 2 then isnull(ad.AD_social_security_number,'')
when @Sort_1 = 3 then isnull(dep.dep_code,'')
when @Sort_1 = 5 then isnull(ctyt.CTYT_text,'') /* #2012# */
when @Sort_1 = 6 then isnull(AD_postal_routing_address,'') /* #2012# */
when @Sort_1 = 7 then isnull(adk1.ADK_key,'') /* #2012# */
when @Sort_1 = 8 then isnull(ppm.PPM_code,'') /* #2012# */
else isnull(emc.emc_contract_number,'')
end,
case when @Sort_2 = 4 then epp.epp_end_date else null end, /* #2012#-1 */
case when @Sort_2 = 4 then isnull(prp.PRP_period_number, 0) else null end, /* #2012#-1 */
case when @Sort_2 = 1 then isnull(emc.emc_contract_number,'')
when @Sort_2 = 2 then isnull(ad.AD_social_security_number,'')
when @Sort_2 = 3 then isnull(dep.dep_code,'')
when @Sort_2 = 5 then isnull(ctyt.CTYT_text,'') /* #2012# */
when @Sort_2 = 6 then isnull(AD_postal_routing_address,'') /* #2012# */
when @Sort_2 = 7 then isnull(adk1.ADK_key,'') /* #2012# */
when @Sort_2 = 8 then isnull(ppm.PPM_code,'') /* #2012# */
else null
end/*, |
Partager