在sql里%是通配符,*号不是,是普通字符或乘号

解决方案 »

  1.   

    create table #a(a varchar(100))
    insert #a values('adfsfsdf')
    insert #a values('sdfsa*sdfsd')
    insert #a values('*')select * from #a where a like '*'select * from #a where a like '%*%'select * from #a where a like '%'drop table #a
      

  2.   

    只有在ACCESS中,没有打开SQL SERVER 兼容语法(ANSI 92) 时,*号才是通配符,而%则不是通配符,在SQL SERVER中,不能使用*作为通配符