如何将此mssql代码更改为MySql

时间:2017-02-04 00:38:02

标签: mysql sql-server sql-server-2008

此代码返回我想要的结果但我在MySQL中需要它

先谢谢

SET @searchstring = 'hot spicy'

set @SQLStatement = 'Select * FROM dbo._TEST_'
IF LEN(@searchstring)>0
    SET @SQLStatement=@SQLStatement+ ' WHERE tast LIKE '+CHAR(39)+'%'
SET @searchstring=Replace (@searchstring,' ', '%'+CHAR(39)+' AND tast LIKE '+CHAR(39)+'%')
IF LEN(@searchstring)>0
    SET @SQLStatement=@SQLStatement+ @searchstring +'%'+ CHAR(39)
IF LEN(@searchstring)>0
    EXECUTE sp_executesql @SQLStatement

GO>

0 个答案:

没有答案