i am trying to run sp its not giving any result when i replace “=” by “Like”
my query is define below,
ALTER PROCEDURE [dbo].[SelectMentor]
-- Add the parameters for the stored procedure here
@Zip varchar(20)=NULL,
@Company varchar(200)=NULL,
@Designation varchar(100)=NULL,
@Interest varchar(200)=NULL
--@JobFunc varchar(200)=NULL
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select ub.user_Id,ub.user_Fullname,up.Designation,up.Company from UserBasics UB
inner join UserProfession up on
ub.user_Id=up.Prof_ID
where (@Zip is null or ub.user_Zip = @Zip) and
(@Interest is null or ub.user_Need = @Interest) and
-- (@JobFunc is null or m.mentor_jobFunction= @JobFunc) and
(@Company is null or up.Company=@Company) and
(@Designation is null or up.Designation=@Designation)
its working fine but when i replace “=” with “Like”,
select ub.user_Id,ub.user_Fullname,up.Designation,up.Company from UserBasics UB
inner join UserProfession up on
ub.user_Id=up.Prof_ID
where (@Zip is null or ub.user_Zip like '%@Zip%') and
(@Interest is null or ub.user_Need like '%@Interest%') and
-- (@JobFunc is null or m.mentor_jobFunction= @JobFunc) and
(@Company is null or up.Company like '%@Company%') and
(@Designation is null or up.Designation like '%@Designation%')
its not working ???
Hopes for your Suggestions
Thanks
Try this
Raj