473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I wildcard a parameter search

Very new to all of this, I have a simple search that shows all invoice information for a client. I need to be able to search for part of the client name rather than an exact match. In Access i know a * will wildcard a search. How do I do it in SQL here is the code

SELECT
dimOrganisation.Name
,dimInstructions.FILENO
,rpt_CIAReports_RawData.InvoiceID
,rpt_CIAReports_RawData.AllocationValue
,dimInvoiceEFI.InvoiceEFIID
,dimInvoice_EFI_Additional.INVOICEPRENAME
,dimInvoice_EFI_Additional.INVOICEADDRESSNAME
,dimInvoice_EFI_Additional.INVOICEADDRESSATTENTION
,dimInvoice_EFI_Additional.INVOICEDATE
,dimInvoiceEFI.DRAFTNO
FROM
dimOrganisation
INNER JOIN dimInstructions
ON dimOrganisation.OrgID = dimInstructions.ORGID
INNER JOIN rpt_CIAReports_RawData
ON dimInstructions.FILENO = rpt_CIAReports_RawData.Instruction_FileNo
INNER JOIN dimInvoiceEFI
ON rpt_CIAReports_RawData.InvoiceID = dimInvoiceEFI.InvoiceID
INNER JOIN dimInvoice_EFI_Additional
ON dimInvoiceEFI.InvoiceEFIID = dimInvoice_EFI_Additional.InvoiceEFIID
WHERE
dimInvoice_EFI_Additional.INVOICEADDRESSNAME = @INVOICEADDRESSNAMe
Feb 23 '18 #1
5 1318
Rabbit
12,516 Expert Mod 8TB
The wildcard in SQL Server is the percent symbol %
Feb 23 '18 #2
How would i include it within this though would it just be @invoiceaddressname%
Feb 27 '18 #3
Rabbit
12,516 Expert Mod 8TB
You do it the same way you would in Access SQL, but you replace the asterisk with a percent.

On a side note, you seem to be using a variable @invoiceaddressname but you haven't defined it anywhere.
Feb 27 '18 #4
I have tried but just adding a % either side does not do anything. Could you show me an example in the code of where it would go. The query works fine it will find an exact match that i type into the parameter, but i need it to be a wildcard search as i am trying to find discrepancies in our data/
Feb 28 '18 #5
Rabbit
12,516 Expert Mod 8TB
It's a string so you have to treat it as such and append it to the search string.

Expand|Select|Wrap|Line Numbers
  1. field1 like @var1 + '%'
You would have to do the same thing if you were using Access and using a variable.
Feb 28 '18 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Job Lot | last post by:
My DataGrid is bound to DataSet which contains relationship between two tables as follows: SqlHelper.FillDataset(strConn, CommandType.StoredProcedure, "spSelectClientApplicant", ds, New String()...
3
by: Gerry Viator | last post by:
Hi all, I want to remove this : With a string function? Can I use the Astric as wild card? If not, how? Dim txtstr as String = "Print Report for MRN from B Database" txtstr =...
0
by: Mark | last post by:
I have some code that starts with... SqlConnection conn = new SqlConnection(Globals.ConnectionString); conn.Open(); try { SqlCommand command = new SqlCommand("SELECT cusid, cusname FROM...
4
by: Cliff | last post by:
Hello I'm trying to search for each instance of a string (using wildcards) in another string. I know there is the Like operator, but it seems to be work with booleans and I want to define a string...
3
by: RoadRunner | last post by:
I have a form that has 6 command buttons on it. Each command button runs a different query with a wildcard parameter value that looks in 6 different tables in 6 different linked databases. None...
2
by: angie | last post by:
I need to figure out how to create a user interface to search a query, but here's the bad part...I need to account for criteria on at least 7 of the fields. Here's what I'm thinking I need to do:...
1
by: almu | last post by:
Hi all, I need help to build a set of queries in PHP/MySQL for a multiple-parameter search form, whereby the user will be able to search any number of ways (upto seven) Thanks
0
by: Tim Golden | last post by:
Robert Dailey wrote: I haven't checked but I doubt this has changed from Python 2.x. Just use os.walk and filter on what you want. Vaguest and most untested code sample: <code> import os...
0
by: savage678 | last post by:
Hi Everyone, I am new to this forum and am i dire need of some help. I am trying to use wildcard searches in infopath. I have it connected to an access database using data connection. I have...
2
by: milton r | last post by:
I have built a database where you click on the combo box lookup button and you are prompted to enter a series of queries in order to filter out the desired search result. My problem is that when I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.