日期:2014-05-17 浏览次数:20563 次
if object_id('[TB]') is not null drop table [TB]
go
create table [TB] (col1 int,col2 nvarchar(4))
insert into [TB]
select null,null union all
select null,null union all
select null,null union all
select null,null union all
select null,null union all
select null,null union all
select 17,'张三' union all
select 15,'李四' union all
select 13,'白华' union all
select 11,'萍乡' union all
select 9,'武汉' union all
select 7,'南昌'
select * from [TB]
SELECT col1,col2 FROM dbo.TB
ORDER BY ISNULL(col1,9999) --给个值行不?
/*
col1 col2
7 南昌
9 武汉
11 萍乡
13 白华
15 李四
17 张三
NULL NULL
NULL NULL
NULL NULL
NULL NULL
NULL NULL
NULL NULL*/