日期:2014-05-17 浏览次数:20484 次
Declare @Sql varchar(1000) Declare @TestTxt varchar(100)='张三' Set @Sql = 'SELECT TOP 10 * FROM T_productDetails WHERE '+CharIndex(@TestTxt,'Title')+'>0' Exec (@Sql)
Declare @Sql varchar(1000) Declare @TestTxt varchar(100) set @TestTxt=N'张三' Set @Sql = 'SELECT TOP 10 * FROM T_productDetails WHERE CharIndex('''+@TestTxt+''',[Title])>0' Exec (@Sql)