select zd 
from t1 
where t1 between 'TE-2000001-01' and 'TE-2000003-01' 
order by zd

解决方案 »

  1.   

    select zd 
    from t1 
    where zd like 'TE-%'
    order by zd
      

  2.   

    --测试数据
    declare @t1 table(zd varchar(30))
    insert @t1 select 'TE-2000001-01'
    union  all select 'TE-2000002-01'
    union  all select 'TE-2000003-01'
    union  all select 'TE1-2000001-01'
    union  all select 'TE-1-2000001-01'
    union  all select 'TE-1-2000002-01'--查询
    select zd from @t1 
    --where zd<='TE-2000003-01' and zd>='TE-2000001-01'
    order by zd collate Chinese_PRC_bin/*--测试结果zd                             
    ------------------------------ 
    TE-1-2000001-01
    TE-1-2000002-01
    TE-2000001-01
    TE-2000002-01
    TE-2000003-01
    TE1-2000001-01(所影响的行数为 6 行)
    --*/
      

  3.   

    -在SQL中比较特殊,所以排序会乱.
      

  4.   

    十分感谢大家!中海大侠的办法 select zd 
    from t1 
    where t1 between 'TE-2000001-01' and 'TE-2000003-01' 
    order by zd 是我想要的结果
    我想知道between 与大于小于的区别,请帮忙指点
      

  5.   

    不好意思,是我模拟的数据有问题,没有从根本上解决问题
    zd 的值应该是 
    tm
    TE1-2000001-01
    TE1-2000002-01
    TE1-2000003-01
    TE1-2000001-01
    TE-1-2000001-01
    TE-1-2000002-01
    查询语句是select zd from t1 where t1<=TE1-2000003-01 and t1>=TE1-2000001-01结果
    中还包括TE-1-2000002-01 为什么呢?