取出表A中Id为两位数的记录取出表A中Id为四位数且前两位跟传进来的参数一样的记录

解决方案 »

  1.   

    1、
    select * from a where len(id)=2
      

  2.   


    select * from A where len(id)=2select * from A where len(id)=4 and left(id,2)=参数
      

  3.   

    2、
    select * from a where len(id)=2 and id like'11%'
      

  4.   


    select * from A where len(id)=2
    select * from A where len(id)=4 and left(id,2)=参数
      

  5.   

    select  * from tb where len(id)=2
      

  6.   

    select * from a where len(id)=2 and left(id,2)=@canshu
      

  7.   

    select * from A where len(id)=4 and left(id,2)=参数
      

  8.   

    select * from A where len(id)=2
    select * from A where len(id)=4 and left(id,2)=参数拜托各位再帮忙把上面的两条sql写成个存储过程参数 是ID 
    我的ID是01,0101,010101这样的分3级
    如果传进来的ID参数ID=01 就找到0101 如果是0101 就找到010101拜托了