SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Simple stored procedure question

    I am trying to write a stored procedure that searches for text and not sure how to put a wild card either side.

    Can someone help please.

    [
    Code SQL:
    ALTER PROCEDURE [wneedham].[adfero_article_search]
     
                @search_text               VARCHAR(255) = NULL
     
    AS
     
    BEGIN
     
     
                SELECT * FROM adfero_articles WHERE contents LIKE 
     
     
                 '%@search_text%'
     
                 ORDER BY created DESC
    END

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try '%' + @search_text + '%'

  3. #3
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •