StoredProcedure:关键字“INNER”附近的语法不正确

时间:2017-03-17 07:49:17

标签: sql stored-procedures

我正在使用SQL服务器存储过程。

我面临错误

  

“关键字'INNER'附近的语法不正确”

以下是我的查询:

set @SQL= 'select pushto as MSISDN,pushprice as Price,pushdate as DateTime,pushtext as Message from '+@tblname+' WITH (NOLOCK) WHERE '+@sqldate + @scodelist+ @clientlist + @piclist +' INNER JOIN INAPremium..INA_Keyword K on R.keyid = K.keyid WHERE '+@sqldate
+ @scodelist+ @clientlist + @piclist + @DNType + @pkeywordlist + @seckeywordlist +' order by pushdate desc'

需要大家帮忙。 谢谢。

3 个答案:

答案 0 :(得分:0)

您发布的查询错误。您在WHERE之前使用了INNER JOIN,实际上应该是其他方式。此外,您有多个WHERE子句

from '+@tblname+' WITH (NOLOCK) 
WHERE '+@sqldate + @scodelist+ @clientlist + @piclist +' 
INNER JOIN INAPremium..INA_Keyword K on R.keyid = K.keyid

应该是

from '+@tblname+' WITH (NOLOCK)      
INNER JOIN INAPremium..INA_Keyword K on R.keyid = K.keyid
WHERE '+@sqldate + @scodelist+ @clientlist + @piclist +'

答案 1 :(得分:0)

您的语法必须为set @SQL= 'select pushto as MSISDN,pushprice as Price,pushdate as DateTime,pushtext as Message from '+@tblname+' WITH (NOLOCK) + ' INNER JOIN INAPremium..INA_Keyword K on R.keyid = K.keyid WHERE '+@sqldate + + @scodelist+ @clientlist + @piclist + @DNType + @pkeywordlist + @seckeywordlist +' order by pushdate desc'

类似的东西:

protected abstract void printResults(Object abc);

答案 2 :(得分:0)

从我的角度来看,这是语法错误。

在INNER JOIN之后,你有一个WHERE,一次在WITH(NOLOCK)之后。

请尝试以下代码:

The plugin w3-total-cache/w3-total-cache.php has been deactivated due to an error: Plugin file does not exist.