将带有数字的 NVARCHAR 拆分为 int 的最简单方法是什么?例如123"中的 1、2 和 3.
What is the easiest way to split NVARCHAR with numbers into int's? For example 1, 2 and 3 from "123".
注意,您也可以使用递归 CTE 来做到这一点:
As a note, you can also do this with a recursive CTE:
with val as (
select '123' as val
),
cte as (
select left(val, 1) as c, substring(val, 2, len(val)) as rest
from val
union all
select left(rest, 1), substring(rest, 2, len(rest))
from cte
where rest <> ''
)
select c
from cte;
这篇关于从字符串 TSQL 中获取数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!