请教存储过程中多参数查询的问题
CREATE PROCEDURE selecttemp
@tname varchar(50) = ' ',
@tsubject varchar(50) = ' ',
@tsex varchar(50) = ' ',
@tetime varchar(50) = ' ',
@teadd varchar(50) = ' ',
@tprice varchar(50) = ' '
请问一下查询语句该如何构造呢?
SELECT t_ID,t_Name,t_Sex,t_Educational,t_School,t_Major,t_Subject,t_E_add FROM Teacher
where
(t_Name Like '% '+@tname+ '% ')and
(t_Sex = @tsex)and
(t_Subject Like '% '+@tsubject+ '% ')and
(t_E_time = @tetime)and
(t_E_add = @teadd)and
(t_Price = @tprice)and
------解决方案--------------------where
(t_Name Like '% '+@tname+ '% ')and
(t_Sex = @tsex or @tsex= ' ')and
(t_Subject Like '% '+@tsubject+ '% ')and
(t_E_time = @tetime or @tetime= ' ')and
(t_E_add = @teadd or @teadd= ' ')and
(t_Price = @tprice or @tprice= ' ')and