+ Reply to Thread
Results 1 to 2 of 2

Passing % to SQL Server using a parameter

  1. #1
    Registered User
    Join Date
    10-19-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    2

    Passing % to SQL Server using a parameter

    I have read a few posts on how to pass a % wildcard from Excel Query to SQL Server. Though I can get it to work with an entered value, the % wildcard does not seem to pass on through. I am using the recommendation, from another post, to have a field with a formula in it that would pull in the user's input from another cell. The cell that the parameter looks for its value has the following formula
    Please Login or Register  to view this content.
    If the user enters a blank in D3, then I get % in the cell of my formula. If the user enters a value like 5678, then I get %5678 in the same cell. The first one returns no records back to the worksheet, the second one returns the record for 5678 only. It would not return any records that had the suffix 5678.

    My query has
    Please Login or Register  to view this content.
    I created a parameter in the Query Wizard that is ORDERPARM. But since it is my only parameter, I am just using the ?. Does anyone know what to do to allow the % wildcard character to pass through? What I would like is for all records to be returned if the user puts a space or leaves the cell D3 blank. They perform the refresh all and it should return all records.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: Passing % to SQL Server using a parameter

    Is your field numeric? I don't think it will work with numbers.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1