CREATE PROC [dbo].[gs_searchkeywords_b]
@Keywords nvarchar(255),
@Ret nvarchar(2000) output
as
begin
set @Ret = N''
declare @total_count int
if ltrim(rtrim(@Keywords)) <> N''
begin
declare @temp_Id int
declare @temp_Name nvarchar
declare cur_Count cursor FAST_FORWARD for select TOP 10 S_Id from GS_SearchString where S_Name like '%'+ @Keywords+ '%' order by S_Count desc
open cur_Count
fetch next from cur_Count into @temp_Id,@temp_Name
while @@fetch_status = 0
begin
declare @temp_sql nvarchar(2000) set @temp_sql = N'select @total_count = count(*) from GS_WebSite where WebName like %''' + @temp_Name + N'''%' exec sp_executesql @temp_sql, N'@total_count int OUTPUT', @total_count output
set @Ret = @Ret + cast(@total_count as nvarchar) + N',' + cast( @temp_Name as nvarchar) + N'&'
fetch next from cur_Count into @temp_Id,@temp_Name
end
close cur_Count
deallocate cur_Count
end
end
GO
大侠帮我检查下语法是否错误啊我@Ret nvarchar(2000) output输出格式是 20,aaa&30,bbb,40,ccc
@Keywords nvarchar(255),
@Ret nvarchar(2000) output
as
begin
set @Ret = N''
declare @total_count int
if ltrim(rtrim(@Keywords)) <> N''
begin
declare @temp_Id int
declare @temp_Name nvarchar
declare cur_Count cursor FAST_FORWARD for select TOP 10 S_Id from GS_SearchString where S_Name like '%'+ @Keywords+ '%' order by S_Count desc
open cur_Count
fetch next from cur_Count into @temp_Id,@temp_Name
while @@fetch_status = 0
begin
declare @temp_sql nvarchar(2000) set @temp_sql = N'select @total_count = count(*) from GS_WebSite where WebName like %''' + @temp_Name + N'''%' exec sp_executesql @temp_sql, N'@total_count int OUTPUT', @total_count output
set @Ret = @Ret + cast(@total_count as nvarchar) + N',' + cast( @temp_Name as nvarchar) + N'&'
fetch next from cur_Count into @temp_Id,@temp_Name
end
close cur_Count
deallocate cur_Count
end
end
GO
大侠帮我检查下语法是否错误啊我@Ret nvarchar(2000) output输出格式是 20,aaa&30,bbb,40,ccc
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货