select top 1 ParameterValue from fsenablers..tbl_app_configurations with (nolock) where applicationcode = and parametername = and ((OwnerId = and OwnerType = ) or (OwnerId = 0 and (OwnerType = '*' or OwnerType = )) ) order by ownerid desc