Create table #temp ([Full Name] varchar(100))
insert into #temp
select 'X-y, z C'
union all
select 'CLOSE, Test G.'
Union all
select 'CMN, DEV S.'
union all
select 'Micheal Land'
UPDATE #temp SET [Full Name]=REPLACE([Full Name],', ',',')
select substring([Full Name],0,CASE CHARINDEX(',',[Full Name]) WHEN 0 THEN LEN([Full Name]) ELSE CHARINDEX(',',[Full Name]) END) Last_Name,
CASE CHARINDEX(',',[Full Name]) WHEN 0 THEN '' ELSE substring([Full Name],CHARINDEX(',',[Full Name])+1,-CHARINDEX(',',[Full Name])+CHARINDEX(' ',[Full Name])) END First_Name,
CASE CHARINDEX(',',[Full Name]) WHEN 0 THEN '' ELSE substring([Full Name],CHARINDEX(' ',[Full Name])+1,LEN([Full Name])) END [Middle-Name] from #temp
什麼是分裂的邏輯是什麼? – DarkKnight
你真的需要一條線上的所有輸出嗎?你有嘗試過什麼嗎?搜索任何東西? – HABO