Creating a search procedure

  • This must be a simple task. I need to create a stored procedure that will prompt the user to enter the first four letters of a name to return all customers with the letters entered

  • Your program (webpage, Visual Basic or whatever) should prompt the user.  Then your program will call the stored procedure with the the 4 letters as a parameter. 

    So you could have a stored proc something like this:

    create proc usp_GetCustomers @Name varchar(4) as

        set @Name = @Name + '%'  -- add the wildcard

        select Name from customers where Name like @Name

        return 0

     

     

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

  • don't we need close the wildcard '%'?

  • Kathi HAS closed the single string quote!







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply