• MyStoredProc(

    @SearchContains VARCHAR(20)=NULL,

    @SearchStartsWith VARCHAR(20)=NULL)

    NOTE: Field 'OrderName' is a VARCHAR field

    SELECT OrderID, OrderName, OrderValue FROM <table>

    WHERE OrderName like '%' + @SearchContains + '%'

    or

    SELECT OrderID, OrderName FROM <table>

    WHERE OrderName like @SearchStartsWith + '%'

    or

    SELECT OrderID, OrderName FROM <table>

    WHERE LEFT( OrderName, LEN(@SearchStartsWith)) = @SearchStartsWith


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA