Sql server sqlserver中的模式匹配
结果是这样显示的Sql server sqlserver中的模式匹配,sql-server,sql-server-2008,sql-server-2005,Sql Server,Sql Server 2008,Sql Server 2005,结果是这样显示的 select Document_id from Document_Master where Document_id like 'APJ1.000753%' 但我想基于下划线计数,结果应该是 APJ1.000753_DIS001.PDF APJ1.000753_IP753_DIS001.PDF APJ1.000753_IP753_OTH001(1).PDF APJ1.000753_IP753_OTH001(2).PDF APJ1.000753_IP753_OTH00
select Document_id
from Document_Master
where Document_id like 'APJ1.000753%'
但我想基于下划线计数,结果应该是
APJ1.000753_DIS001.PDF
APJ1.000753_IP753_DIS001.PDF
APJ1.000753_IP753_OTH001(1).PDF
APJ1.000753_IP753_OTH001(2).PDF
APJ1.000753_IP753_OTH001.PDF
APJ1.000753_OTH001.PDF
APJ1.000753_DIS001.PDF
APJ1.000753_OTH001.PDF
APJ1.000753_IP753_DIS001.PDF
APJ1.000753_IP753_OTH001(1).PDF
APJ1.000753_IP753_OTH001(2).PDF
APJ1.000753_IP753_OTH001.PDF
select Document_id
from Document_Master
where Document_id like 'APJ1.000753%'
order by len(Document_id) - len(replace(Document_id, '_', '')), Document_id