Search exact text in a string - string

I am querying a SQL Server DB. I have a field "Remarks" that contains values pipe delimited as such
59P|W26|W511|862|W51
I'm trying to search in this field for an exact match, for example in the above I just want to return W51 not W511. I thought contains would help but unfortunately the table is not full text indexed and I dont have the ability to change that. Any suggestions?

It looks like you can do this using sql server because it has a useful built in function. Check out https://www.sqlservertutorial.net/sql-server-string-functions/sql-server-string_split-function/

Related

Solr Query Parameter LIKE

I want to search through my content using Solr. My question is, is there a possibility to search for a text, which contains a certain character sequence?
Example: I have a text like "This is my Regitrationmail"
I want a query for the search of "registration" or "mail" or even "Registrationm" etc. etc.
Also the query should match if the content or the title match the query.
this is my current query:
q=text:registration~20
Thanks for your help!

Azure Search returning incorrect results

I'm using Azure Search to query a data set relating to documents. I'm querying the data to fetch the documents that are owned by a particular user based on their email address.
The data set within the index contains a column called UploadedBy which represents the user who uploaded the document.
My query looks like this.
search=myuseremail#mycompany.com&searchFields=UploadedByEmail
The search query speficies the value to look for and the column in which to search for it. However, I'm getting results returned that do not match this search criteria i.e. where the email address contains a different email address.
How do I prevent these from being returned? Am I missing something from my seach?
probably you're getting results that match:
myuseremail#abcde.com
and
*#mycompany.com
this is not wrong, it's the expected behavior since an email has '.' and it's considered a stop word. If you want the exact match, you should use search="myuseremail#mycompany.com", escape your '.' or replace them to another char that is not a stop word.
As another option, use a custom analyzer to avoid breaking on "." for emails.

Data Parameter in Excel not working with Access Query Connection

I have a connection to an Access DB query within Excel. The field in the Access query is an expression turning a field into a proper date. The problem that I'm having in Excel lies within passing the parameter from a cell containing the date that I want the query to run for. The results are either completely wrong or result in nothing. I have tried modifying the parameter cell to just about everything to no avail. I have tried the edit query option under view connection and when prompted to put in the value for the parameter, it actually returns the data I want. I would thing that this would be exactly the same parameter it would be grabbing from the formatted cell?
I have attached my connection's SQL command text below. And also an image with more detail and screenshots.
This is the command text from Excel containing my Where clause:
SELECT Query1.SETYPE, Query1.`SEORD#`, Query1.ORBILL, Query1.ORCUST, Query1.ORLDAT,
Query1.ORCONS, Query1.SESEV, Query1.CMTYPE, Query1.CMTEXT, Query1.ORDDATfix
FROM `C:\USERS\DRED\DESKTOP\ServiceFailures.accdb`.Query1 Query1
WHERE Query1.ORDDATfix =?
SELECT Query1.SETYPE, Query1.`SEORD#`, Query1.ORBILL, Query1.ORCUST, Query1.ORLDAT, Query1.ORCONS, Query1.SESEV, Query1.CMTYPE, Query1.CMTEXT, Query1.ORDDATfix
FROM `C:\USERS\DRED\DESKTOP\ServiceFailures.accdb`.Query1 Query1
WHERE (Query1.ORDDATfix>=?)
Apparently putting the clause in parenthesis fixed the problem.

Check if a value is inside a sql String field with many values

I have a sql field with values like "test had, that , much never";
I want to know wether "had" is in that list if yes return the whole datarow.
There was a sql server function like "In" Select value in (fieldname)...
anyone can tell me, thanks :)
p.s. dont want to use the "like" which is slow.
If you don't want to use LIKE consider Full Text Indexing and the CONTAINS statement instead.

Need Query without Field names retriving in MDB?

I am using the MDB as backend, frontend using vb. When i am retriving the output in excel the result provide the output the result with field names. I only need the result, how can i avoid the field name display for that. I am new in this MDB and vb. Please help me for a query providing the result without field names.
Change connection string to exclude headers, as in HDR=No.
Connection strings for Excel at http://www.connectionstrings.com/excel
To retrieve only the data - no headers - simply use the GetString method of your ADODB.Recordset.... I assume you are using ADO....

Resources