可以是这样的形式吗?我尝试选择案例,但总是发生错误。如果有任何帮助,我将不胜感激。
CREATE PROCEDURE searchStatement
(
@word1 varchar(50),
@word2 varchar(50),
@word3 varchar(50)
)
as
select * from words where 1=1
if @word1 <> '-1'
and word1 =@word1
if @word2 <> '-1'
and word2 =@word2
if @word3 <> '-1'
and word3 =@word3