mssql查询括号前的数据及括号中的数据
select CASE WHEN CHARINDEX('—',Name)=0 THEN REVERSE(stuff(reverse(Name), 1, charindex('(', reverse(Name)), '')) ELSE '' END AS name,
CASE WHEN CHARINDEX('(',Name)>0 THEN SUBSTRING(Name , charindex('(' , Name) + 1 , charindex(')' , Name) - charindex('(' , Name) - 1) ELSE ''END AS unti
,*
FROM dbo. LX_CBB_DQCS_CD