with data as ( SELECT c.countryId, c.country, c.country2DCode, c.countryAbbrev ,case when countryId = #_cid# then #_sortRank# else 999999 end as sortRank FROM tbl_UT_Countries c with (nolock) where c.countryId in ( ) ) #forJSON( 'data', attributes.datastore, 'sortRank' )#