SQL 单元格数据分割
我遇到一个问题如何把下面的单元格分割成我想要的
期望的结果
望大家不惜指教
[解决办法]
declare @details nvarchar(50)
set @details='10.2.0.1 DEV_10 zhang_san'
select left(@details,charindex(' ',@details)-1) as ip,
substring(@details,charindex(' ',@details)+1,charindex(' ',substring(@details,charindex(' ',@details)+1,len(@details)))-1) as department,
right(@details,charindex(' ',REVERSE(@details))-1) as user