Questions tagged [instr]
89 questions
2
votes
1 answer
How to select rows with \u0000 (null character) in a varchar column in SQLite?
Long story short, lots of bogus data entered the SQLite database over time, where there is valid data before a null character in a varchar column - and then bogus data afterwards. I'm using \u0000 to represent the null character…

Aurora Lahtela
- 23
- 5
2
votes
1 answer
Find position of first number in string and split
I am attempting to find the first numeric character in an ID composed of a client segment identifier (ABC_), a geographic identifier (UK) and a number (1234567).
The ID will without exception follow this logic:
ABC_UK1234567
From this, I need to…

DVEF
- 47
- 4
2
votes
2 answers
How to run select query on columns having comma separated values
I know how to separate comma-separated column values into different columns. However, my question is how to query these columns in a where condition. I have a sample table named 'Details' below.
User Department
---- ----------
…

Sid133
- 354
- 2
- 17
2
votes
1 answer
does something like followin exists? ('''select * from TABLE where ? in FIELD''',(VAR))
does something like followin exist?
('''select * from TABLE where ? in FIELD''',(VAR))
I need to select all table rows where FIELD just contains the text of VAR (so not needed FIELD=VAR)
I'm using python3 and sqlite3.

Tommy
- 101
- 8
2
votes
0 answers
Use Instr with range/column instead of singular cell/manual inputted values
I am new to using macros and I need some help. I am parsing scientific data sets with a good mount of rows, so I am trying to pull out only the needed rows, based on what sample data I need. The exact number of values I would search for also changes…

Alan
- 21
- 1
2
votes
1 answer
InStr vs indexOf
Is this ASP InStr function equivalent to the js indexOf function :
ASP :
<%
Function validation(ByVal var2)
If (InStr(var1, "," & var2 & ".") = 0) Then
validation = 1
Exit Function
End If
End Function
%>
JS :
validation = function(var2)…

user3470686
- 31
- 1
- 3
2
votes
3 answers
Oracle SQL: Is it possible using SUBSTR and INSTR to return ALL Strings in a given text field?
I'm working with some data which is stored in a VARCHAR2(4000) column and the data is mainly text comments but also contains dates within the text. I've written a query which uses SUBSTR and INSTR to pattern match and find a leading Text value prior…

user7329642
- 67
- 1
- 6
1
vote
1 answer
Single line expression/formula for matching the string from comma separated list
I have following string which is a comma separated list
Dim str1,…

Amol Lokhande
- 11
- 1
1
vote
1 answer
Correct SQL syntax selecting from two tables using values from first table
I am trying to perform a SQL query in SQL Server.
What is correct syntax for pulling from data from two tables using a value from the first table to query the second table?
Can I extract a string of text from the first table column and use to…

MMariani
- 21
- 2
1
vote
3 answers
VBA: Multiple OR conditions in single InStr?
Is there an efficient way to have a single InStr have a list of expressions sought?
The segment of my code in question:
For Each sf In oFolder.SubFolders
If InStr(1, sf, "STAG", vbTextCompare) Or InStr(1, sf, "STAP", vbTextCompare) Then
…

Sange7
- 15
- 5
1
vote
1 answer
How to retrieve the required string in SQL having a variable length parameter
Here is my problem statement:
I have single column table having the data like as :
ROW-1>> 7302-2210177000-XXXX-XXXXXX-XXX-XXXXXXXXXX-XXXXXX-XXXXXX-U-XXXXXXXXX-XXXXXX
ROW-2>>…

Prashant Rawat
- 11
- 3
1
vote
1 answer
SQL Statement - CHARINDEX Invalid Function
I want to split a string and get the value after the space and am using below query. However i am getting an error that CHARINDEX is not valid. Are there any ways i can get around this?
SELECT productname,
SUBSTRING(productname, instr(' ',…

Adam
- 45
- 4
1
vote
0 answers
Extracting first word from a string in vba, where the nth string is a single word
I am able to extract the first word from a string, using VBA, by searching for the space between two words. The code is like this:
Sub ConnectionTable()
Dim j As Integer
Dim i As Integer
For j = 6 To 8
For i = 2 To 8
If (InStr(1,…

Tessa
- 53
- 6
1
vote
2 answers
Extract string between spaces using location based on instr
All - I'm stuck and need some assistance please. I have a string which is a free-text field to the end user. I need to extract a specific string of text from within this field.
Text is in an array and I have confirmed location of necessary text with…

J.T.
- 31
- 1
- 6
1
vote
1 answer
VBScript - Spliting a String with 2 target chars, turning them in composite Array and then removing those unnecessary from the array
I have a question that could be easy or not.
I will explain further: I have a string like this:
str = "TR~Maintenance~fas plus-maintenicon|GR~Supplies~fas minus-suppicon|JK~Affidavit~fas minus-affiicon"
Now, my objective is to put those in an array…

Joao
- 85
- 1
- 9