最佳答案
我有一个 sproc (MSSQL 2k5) ,它将接受一个 LIKE 子句的变量,如下所示:
DECLARE @SearchLetter2 char(1)
SET @SearchLetter = 't'
SET @SearchLetter2 = @SearchLetter + '%'
SELECT *
FROM BrandNames
WHERE [Name] LIKE @SearchLetter2 and IsVisible = 1
--WHERE [Name] LIKE 't%' and IsVisible = 1
ORDER BY [Name]
不幸的是,当前运行的行抛出了一个语法错误,而带注释的 where 子句运行得很好。有人能帮我把未注释的线路修好吗?