那位弟兄帮我看一下,这个SQL过程怎么没有输出结果呢,分不够可以加
=============================================
SQL过程代码:
ALTER PROCEDURE sq_JingDianGetLine
@TopNum varchar(20),
@JingDianID varchar(60)
AS
begin
DECLARE @LineKey varchar(70), @str varchar(1000)
select @LineKey= '% ' + (select [ks_linekey] from [ks_article] where [newsid]=@JingDianID) + '% '
select @str= 'select top ' + @TopNum + ' '
select @str=@str + '[ks_article].[title], '
select @str=@str + '[ks_article].[FullTitle], '
select @str=@str + '[ks_article].[Fname], '
select @str=@str + '[ks_article].[Ks_lineprice], '
select @str=@str + '[ks_class].[Folder] ' + ' '
select @str=@str + 'from [ks_article] JOIN [ks_class] ' + ' '
select @str=@str + 'ON [ks_article].[Tid]=[ks_class].[ID] ' + ' '
select @str=@str + 'where (tid in(select [id] from [ks_class] where ts like ' '%20071783383214%+ ' ')) and ((Title like ' + @LineKey + ') or (KeyWords like ' ' ' + @LineKey + ')) ' + ' '
select @str=@str + 'order by IsTop desc,Recommend desc,adddate desc '
select @TopNum,@JingDianID,@LineKey,@str
exec(@str)
end
========================================
测试语句:
exec sq_JingDianGetLine '10 ', '7487856525693 '
输出结果是:
@LineKey,@str
这两个变量输出为NULL
=============================================
@LineKey,@str请问这两个变量为什么会输出为空呢
------解决方案--------------------看看這個有沒有結果
select [ks_linekey] from [ks_article] where [newsid]= '7487856525693 '