select * from table1 where '1234567' like aaa+'%'

解决方案 »

  1.   

    同意楼上.或者用:
    select * from table1 where charindex(aaa,'1234567')=1
      

  2.   

    --下面是测试--测试数据
    declare @t table(aaa varchar(10))
    insert into @t
    select '234'
    union all select '123'
    union all select '12345'
    union all select '123456'
    union all select '123456789'--查询
    select * from @t where charindex(aaa,'1234567')=1/*--测试结果
    aaa        
    ---------- 
    123
    12345
    123456(所影响的行数为 3 行)--*/