sql 1.1 1.1.1 1.10.1 排序
时间:2021-07-01 10:21:17
帮助过:32人阅读
) )
RETURNS INT
BEGIN
DECLARE @Count INT
DECLARE @OrderNum INT
SET @Count =
6 --
根据需求改变
SET @OrderNum =
0
WHILE CHARINDEX(‘.‘, @Sequence) >
0
BEGIN
SET @OrderNum =
@OrderNum
+ CAST(SUBSTRING(@Sequence,
0, CHARINDEX(
‘.‘, @Sequence)) AS NUMERIC)
* POWER(
20, @Count)--
根据需求改变
SET @Sequence =
SUBSTRING(@Sequence,
CHARINDEX(‘.‘, @Sequence) +
1,
LEN(@Sequence))
SET @Count = @Count -
1
END
SET @OrderNum = @OrderNum + CAST(@Sequence AS NUMERIC) * POWER(
20,---
根据需求改变
@Count)
RETURN @OrderNum
END
--结果:
3.3.
1.3.
1=>
201784400
sql 1.1 1.1.1 1.10.1 排序
标签:pre charindex 排序 add function 序号 cti string sequence