好像没有。[baseinfo_str_district] like @Area 在该列上就不使用索引了试试在其他列上建立索引

解决方案 »

  1.   

    datalength()函数肯定会影响速度的,改为baseinfo_str_pic is not null试试
      

  2.   

    [baseinfo_str_pic]貌似是个IMAGE字段CREATE PROCEDURE [flash_Shop] 
    (@Area [VarChar](20)) 
    AS 
    select top 8 [id],[baseinfo_str_projname],[baseinfo_str_pic] 
    from [Zu] 
    where [baseinfo_str_pic] IS NOT NULL and 
    [baseinfo_str_district] like @Area and 
    ([baseinfo_str_thingtype]='商铺' or [baseinfo_str_thingtype]='写字楼' or 
    [baseinfo_str_thingtype]='厂房' or [baseinfo_str_thingtype]='地皮' or 
    [baseinfo_str_thingtype]='仓库')  
    order by [Id] desc 
    GO
      

  3.   


    --try
    CREATE PROCEDURE [flash_Shop] 
    (@Area [VarChar](20)) 
    AS 
    select top 8 [id],[baseinfo_str_projname],[baseinfo_str_pic] from [Zu] 
    where datalength([baseinfo_str_pic])>0 
      and charindex(@Area,[baseinfo_str_district])>0  
      and charindex([baseinfo_str_thingtype],'商铺 写字楼 厂房 地皮 仓库') >0
     order by [Id] desc 
    GO
      

  4.   

    用is Not null 不行。会有空记录
    还有其他的办法吗?