日期:2014-05-17 浏览次数:20533 次
if object_id('[TB]') is not null drop table [TB]
go
create table [TB] (col nvarchar(100))
insert into [TB]
select '[Opt:+17] [Var:27037768484]' union all
select '[Opt:+3] [Var:202444813]' union all
select '[Opt:+1] [Var:825]' union all
select '[Opt:+2] [Var:825]'
select * from [TB]
SELECT * FROM TB
ORDER BY CONVERT(INT,REPLACE(SUBSTRING(col,7,3),']',''))
/*
[Opt:+1] [Var:825]
[Opt:+2] [Var:825]
[Opt:+3] [Var:202444813]
[Opt:+17] [Var:27037768484]*/