私はこれを持っています
declare @testtable table (test nvarchar(max))
insert into @testtable (test) values ('1.2.3')
insert into @testtable (test) values ('1.20.3')
insert into @testtable (test) values ('1.19.x')
insert into @testtable (test) values ('1.x.x')
insert into @testtable (test) values ('1.19.3')
insert into @testtable (test) values ('DEC09')
insert into @testtable (test) values ('Plutonium')
insert into @testtable (test) values ('dec09')
insert into @testtable (test) values ('N/A')
insert into @testtable (test) values ('MyTest20')
insert into @testtable (test) values ('20MyTest')
insert into @testtable (test) values ('1.4.18')
insert into @testtable (test) values ('1.4.168')
select * from @testtable
order by test asc;
出力する
1.19.3
1.19.x
1.2.3
1.20.3
1.4.168
1.4.18
1.x.x
20MyTest
DEC09
dec09
MyTest20
N/A
Plutonium
しかし、出力順序を
1.2.3
1.4.18
1.4.168
1.19.3
1.19.x
1.20.3
1.x.x
20MyTest
DEC09
dec09
MyTest20
Plutonium
N/A
(N/A は「マジック」であり、常に最大であることに注意してください。「バージョン」(例: 1.2.3) は常に 3 桁ですが、1 つ以上の桁が「任意の桁」を示すために char x である場合があります。これは常に可能な限り最大のものと見なされます)桁)
SQL Server でこれを行うにはどうすればよいですか?