passing parameters using select * Like

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nairjones
    New Member
    • Aug 2007
    • 3

    passing parameters using select * Like

    Hello, I have never had trouble using parameters in the applications i developed, however i with this one - well u know: THIS HOW IT IS ANYWAY - U KNOW HOW U CAN USE A QUERY SAY TO SEARCH A NAME WITH CERTAIN SET OF LETTERS IN IT FOR EXAMPLE : SELECT * FROM TABLENAME WHERE NAMEFILED LIKE '%KAB%' THIS LISTS ALL NAMES WITH THE LETTERS "kAB" IN IT BU NOW I NEED TO CREATE A PROCEDURE IN WHICH A PARAMETER CAN BE PASSED FROM THE MSACCESS CLIENT TO SEARCH FOR THE NAME.

    FOR EXAMPLE THE "KAB" IS PASSED TO A PARAMETER @NAME! I AM STUCK NEED HELP BAAAAAD!
  • azimmer
    Recognized Expert New Member
    • Jul 2007
    • 200

    #2
    Originally posted by nairjones
    Hello, I have never had trouble using parameters in the applications i developed, however i with this one - well u know: THIS HOW IT IS ANYWAY - U KNOW HOW U CAN USE A QUERY SAY TO SEARCH A NAME WITH CERTAIN SET OF LETTERS IN IT FOR EXAMPLE : SELECT * FROM TABLENAME WHERE NAMEFILED LIKE '%KAB%' THIS LISTS ALL NAMES WITH THE LETTERS "kAB" IN IT BU NOW I NEED TO CREATE A PROCEDURE IN WHICH A PARAMETER CAN BE PASSED FROM THE MSACCESS CLIENT TO SEARCH FOR THE NAME.

    FOR EXAMPLE THE "KAB" IS PASSED TO A PARAMETER @NAME! I AM STUCK NEED HELP BAAAAAD!
    I don't really see a problem here, the example below works fine (it's a function not a procedure but illustrates the point):
    Code:
    create function myfind (@name as varchar(255)) returns table
    as
    return select * from myTable where NameField like '%'+@name+'%'
    Use it like this:
    Code:
    select * from myfind('KAB')

    Comment

    • Purple
      Recognized Expert Contributor
      • May 2007
      • 404

      #3
      Hi nairjones,

      I would like to direct you the the posting guidelines here. Please read as your post does not comply with the site guidelines.

      Purple

      Moderator

      Comment

      • nairjones
        New Member
        • Aug 2007
        • 3

        #4
        Originally posted by azimmer
        I don't really see a problem here, the example below works fine (it's a function not a procedure but illustrates the point):
        Code:
        create function myfind (@name as varchar(255)) returns table
        as
        return select * from myTable where NameField like '%'+@name+'%'
        Use it like this:
        Code:
        select * from myfind('KAB')

        Thanks alot works well.

        Comment

        Working...