1
declare @strorder nvarchar(
200
)
2
declare @ismulorder
int
3
declare @firstOrder nvarchar(
200
)
4
declare @secondOrder nvarchar(
200
)
5
6
set
@strorder
=
'
LastModifyDate Desc,OurPrice Asc
'
7
8
select CHARINDEX(
'
,
'
,@strorder,
0
)
9
--
select LEN(@strorder)
10
--
select SUBSTRING(@strorder,
0
,CHARINDEX(
'
,
'
,@strorder,
0
))
11
--
select SUBSTRING(@strorder,CHARINDEX(
'
,
'
,@strorder,
0
)
+
1
,LEN(@strorder))
12
set
@ismulorder
=
CHARINDEX(
'
,
'
,@strorder,
0
)
13
if
@ismulorder
>
0
14
begin
15
set
@firstOrder
=
'
p.
'
+
SUBSTRING(@strorder,
0
,CHARINDEX(
'
,
'
,@strorder,
0
))
16
set
@secondOrder
=
'
p.
'
+
SUBSTRING(@strorder,CHARINDEX(
'
,
'
,@strorder,
0
)
+
1
,LEN(@strorder))
17
set
@strorder
=
@firstOrder
+
'
,
'
+
@secondOrder
18
end
19
20
21
select @strorder