可以拆分这些数据吗?
DATA
----------
FORD3000
MILLER1300
我想这样做:
ENAME | SAL
------------
FORD 3000
MILLER 1300
答案 0 :(得分:4)
是。
select
substring(data, 1, PATINDEX('%[0-9]%',data)-1) as ename,
substring(data, PATINDEX('%[0-9]%',data), len(data)) as sal
from
table
答案 1 :(得分:-1)
SELECT SUBSTRING(@ourName, 1, CHARINDEX(' ', @ourName)) AS [First],
SUBSTRING(@ourName, CHARINDEX(' ', @ourName) + 2, LEN(@ourName)) AS[Last]