我希望能夠輸入一個單詞到「其中」條款,並搜索所有該單詞是類似於可以這樣做CHARINDEX找到相關的文字或類似
DECLARE @Test VARCHAR (200)
SET @Test = 'Red'
SELECT H.Name, O.Name AS 'Owner', S.SilksName, T.Name AS 'Trainer'
FROM Horse H
INNER JOIN Owner O on CHARINDEX(@Test,O.Name) <> 0 or
INNER JOIN Trainer T ON CHARINDEX(@Test,T.Name) <> 0 or
INNER JOIN Runners R ON Horse.Horse_Skey = Runners.Horse_Skey
INNER JOIN Silks S ON CHARINDEX(@Test,S.SilksName) <> 0 or
INNER JOIN Jockey J ON CHARINDEX(@Test,J.FirstName) <> 0
WHERE @Test = 'Red'
您正在尋找「SQL Server中的全文搜索」。 (在你的搜索引擎中輸入這些單詞並點擊搜索按鈕。) – 2013-05-07 07:58:45
WHERE @Test ='%Red%' – 2013-05-07 08:00:01
Hi Alpesh我收到以下錯誤消息 Msg 156,Level 15,State 1,Line 7 語法錯誤靠近關鍵字'INNER'。 – wafw1971 2013-05-07 08:08:03