1

可以拆分这些数据吗?

DATA
----------
FORD3000
MILLER1300

我想让它像这样:

ENAME | SAL
------------
FORD    3000
MILLER  1300
4

2 回答 2

4

是的。

 select 
    substring(data, 1, PATINDEX('%[0-9]%',data)-1) as ename,
    substring(data, PATINDEX('%[0-9]%',data), len(data)) as sal
 from 
     table
于 2012-10-04T11:24:38.533 回答
-1
SELECT SUBSTRING(@ourName, 1, CHARINDEX(' ', @ourName)) AS [First],
SUBSTRING(@ourName, CHARINDEX(' ', @ourName) + 2, LEN(@ourName)) AS[Last]
于 2012-10-04T11:28:04.500 回答