日期:2014-05-16 浏览次数:20712 次
print @@version
if '-' < '1' print '''-'' < ''1'''
if '-a' < '1a' print '1'
if '-a' = '1a' print '2'
if '-a' > '1a' print '3'
if '-a' > '1a' print '''-a'' > ''1a'''
drop table #test
create table #test (test varchar(20) )
insert #test
select '-1147721273'
union all select '1147721284'
union all select '114772125'
union all select 'a1'
union all select 'a3'
union all select '-a2'
union all select 'a-2'
union all select 'a-4'
union all select 'a4'
select * from #test order by 1
/* 执行结果
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (X64)
Jul 9 2008 14:17:44
Copyright (c) 1988-2008 Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (VM)
'-' < '1'
3
'-a' > '1a'
(9 行受影响)
(1 行受影响)
test
--------------------
114772125
-1147721273
1147721284
a1
-a2
a-2
a3
a4
a-4
(9 行受影响)
(1 行受影响)
*/