1.建个简单索引,当然如果你的表没建clusted索引,也可建成clusted,create index intime_ind on IPtbl(intime)2.我也觉得没有建存储过程的必要,你要的话写个例子给你if exists(select 1 from sysobjects where id=object_name(N'p_getResult') and xtype='P')
drop procedure p_getResult
gocreate procedure p_getResult
@stTime datetime,
@enTime datetime,
@ip varchar(15)
as
  select Id From IPtbl where intime between @stTime and @enTime and ip=@ip
goexec p_getResult '2006-1-1 15:14:11','2006-1-1 15:14:11','192.168.1.2'

解决方案 »

  1.   

    intime 上聚集索引
    Ipaddress  上非聚集索引
      

  2.   

    ----intime 上建聚集索引
    create clustered index iptbl_intime on iptbl(intime)   
    go ----Ipaddress 上建非聚集索引create nonclustered index  iptbl_ip  on iptbl(ip)
    go
      

  3.   

    在Intime和IpAddress上建索引,当然也可以用这两个字段建组合索引,
    不过要注意顺序,intime要在前
      

  4.   

    万分感谢..差点留泪..我的群..集了csdn的高手..请大家加入.!14471754