CREATE proc [dbo].[Search]
(
@word1 nvarchar(20)=null,
@word2 nvarchar(20)=null,
@word3 nvarchar(20)=null,
@word4 nvarchar(20)=null,
@word5 nvarchar(20)=null,
@word6 nvarchar(20)=null,
@word7 nvarchar(20)=null,
@word8 nvarchar(20)=null,
@word9 nvarchar(20)=null,
@word10 nvarchar(20)=null,
@id INT=null,
@bigid int=null,
@ResultCount int output
)asdeclare @TempTable table
(
id int,
title nvarchar(200),
content text,
userid varchar,
bigtypeid int,
smalltypeid int,
keyword varchar(2000),
wenjianmc varchar(200),
PublishDate datetime,
checkdate datetime,
checkperson varchar(50),
state int,
clicks int,
pingbici varchar(500),
content2 text,
Rank int
)insert into @TempTable
select id,title,content,userid,bigtypeid,smalltypeid,keyword,wenjianmc,PublishDate,checkdate,checkperson,state,clicks,pingbici,content2,
3*dbo.WordCount(@word1,title)+dbo.WordCount(@word1,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word2,title)+dbo.WordCount(@word2,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word3,title)+dbo.WordCount(@word3,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word4,title)+dbo.WordCount(@word4,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word5,title)+dbo.WordCount(@word5,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word6,title)+dbo.WordCount(@word6,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word7,title)+dbo.WordCount(@word7,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word8,title)+dbo.WordCount(@word8,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word9,title)+dbo.WordCount(@word9,SUBSTRING(content,1,2000))+
3*dbo.WordCount(@word10,title)+dbo.WordCount(@word10,SUBSTRING(content,1,2000))
as Rank
from wd_wendang
order by Rank Desc
if(@id is not null and @bigid is not null)
begin
select id,title,content,substring(content,1,85) as CotentTip,userid,bigtypeid,smalltypeid,keyword,wenjianmc,PublishDate,checkdate,checkperson,state,clicks,RANK
from @TempTable where Rank>0 and id=@id and bigtypeid=@bigid order by Rank desc
end if(@id is null or @bigid is null)
begin
select id,title,content,substring(content,1,85) as CotentTip,userid,bigtypeid,smalltypeid,keyword,wenjianmc,PublishDate,checkdate,checkperson,state,clicks,RANK
from @TempTable where Rank>0 order by Rank desc
end
select @ResultCount=count(*)from @TempTable where rank>0
GO具体代码如上..... 数据里的字段,因为是用的sql2000,所以用的text,
后天CS文件中 是用数据库适配器Fill()方法填充的.......... 提示将截断为字符串或二进制....
是数据库字段可容纳的长度不够.?,....求好心人给你明确的错误所在,请提出解决方法, 不胜感激........谢谢.......
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货