July 28, 2009 at 2:26 am
Dear Borther,
In this store procedure i want search the title, description and link from search_search table but it does not show the result. I did not find any mistak in the store procedure please check the store procedure then tell me where i am wrong. the store procedure is defined here..
ALTER PROCEDURE [dbo].[Search_Web]
-- Add the parameters for the stored procedure here
@SearchText varchar(50)
AS
BEGIN
Select Title, Description, link
From Search_Search
Where Title Like 'SearchText%' AND Description Like 'SearchText%' AND link Like 'SearchText%'
Order by Clicks
END
Thanks in advance
Best regards
Waqar Hussain Laghari
July 28, 2009 at 2:49 am
WHERE Title LIKE SearchText + '%'
AND [Description] LIKE SearchText+ '%'
AND link LIKE SearchText + '%'
July 28, 2009 at 3:08 am
using variables
WHERE Title LIKE @SearchText + '%'
AND [Description] LIKE @SearchText+ '%'
AND link LIKE @SearchText + '%'
July 28, 2009 at 3:26 am
Dear brother,
I have check these both to put into my store procedure but again it is not showing me result... Here is store procedure...
ALTER PROCEDURE [dbo].[Search_Web]
-- Add the parameters for the stored procedure here
@SearchText varchar(50)
AS
BEGIN
Select Title, Description, link
From Search_Search
Where Title LIKE @SearchText + '%' AND [Description] LIKE @SearchText+ '%' AND link LIKE @SearchText + '%'
Order by Clicks
END
Please check this..
Best regards
Waqar Hussain Laghari
July 28, 2009 at 4:16 am
Can you post some sample data and the expected result ? otherwise it is really just guess work from our part.
July 28, 2009 at 4:31 am
I have table Search_Search Which contains these fields..
SearchID Title Description Link Clicks
1 Sindh This is Pakistan State http://www.sindh.com 10
2 Karachi this is pakistan city http://www.karachi.com 20
I want search from this if User provide me like Pakistan.. then Store Procedure will check the Pakistan word from title, description and link then it will show result like this....
Title Description link
Karachi this is pakistan city http://www.karachi.com
Sindh this is pakistan State http://www.sindh.com
ok Dear... If you have any question then ask me..
I need this output
Best regards
Waqar Hussain Laghari
July 28, 2009 at 4:49 am
Okay I think part of the problem is that you are using AND which means that all the columns would have to contain 'Pakistan' where you may want to use OR, also if you want to search any part of the column and not just the leading edge then you need to use a leading '%' as well try,
WHERE Title LIKE '%' + @SearchText + '%'
OR [Description] LIKE '%' + @SearchText+ '%'
OR link LIKE '%' + @SearchText + '%'
July 28, 2009 at 5:01 am
Thank you very much..
Best regards
Waqar Hussain Laghari
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply