Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: Search Function

  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: Search Function

    Hi all I have a search function in one of my database's that when you click on the command button it window comes up that ask you for the last name. What I would like to do is alter it so that users can type in SM and get all the names that start with SM or Ma?? Like a Starts with. How can I do that
    Code:
    = N'[@Enter_LastName].[dbo.Revocatiions] ALike [ta%]'
    Code:
    CREATE FUNCTION dbo.Revocations
    (@Enter_LastName nvarchar(50))
    RETURNS TABLE
    AS
    RETURN ( SELECT  [SSN], [TM#], FirstName, LastName, ReasonofRevocation, Notes, [I/R #], Date
    FROM        dbo.Revocations_Tbl
    WHERE     (LastName = @Enter_LastName))
    Last edited by desireemm; 11-06-07 at 17:49.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    WHERE name LIKE @valueEntered & '%'
    ??
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Red face My Post

    I'm sorry did that not make sense??

    sorry guys

  4. #4
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Change the & to a + in post#2 code from georgev
    You need to explain more if that is not what you are looking for.

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    WHERE Col LIKE @param + '%'

    why would you use a function and not a sproc?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I prefer to get the users to embed the wildcards themselves. Otherwise you get complaints that 'Smith' returns 'Smithy', 'Smithfield', 'Smithalophagos' etc

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by pootle flump
    I prefer to get the users to embed the wildcards themselves. Otherwise you get complaints that 'Smith' returns 'Smithy', 'Smithfield', 'Smithalophagos' etc

    "You were serious about that"

    "I'm gonna hold ylou in contempt"

    "well there's a gig f suprise"

    --Vinne
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i'm still trying to figure out how the user can enter SM and expect to "get all the names that start with SM or Ma"

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I met a guy a month ago. When arranging to meet I asked if we were meeting in PubA or PubB? He sid "Yes".

    Batard.

  10. #10
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    That's what you get for meeting up with strange guys in pubs!

    -PatP

  11. #11
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    Quote Originally Posted by Pat Phelan
    That's what you get for meeting up with strange guys in pubs!
    I've heard public restrooms are also a no-no for meeting up with strange men.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

  12. #12
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    only if you're an american senator
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  13. #13
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    I dunno...seems a tad seedy even if you aren't an american senator. However, being the strange man that I myself am, I have had good luck a time or two (OK, once) with meeting a strange woman in a public restroom.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

  14. #14
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    If she was in the mens restroom, there may have been more strange about her than was immediately apparent.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  15. #15
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    damn...and I thought when I saw her go standing up that she was just a talented woman....now I am not sure she was either.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

Posting Permissions

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