Questions tagged [substring]
The SUBSTRING function is used to return a portion of a string.
62 questions
-1
votes
2
answers
85
views
MariaDB trigger using Substring gives error "Function does not exist, Check Function Name Parsing in the manual"
I have this trigger as a test. It has to do a lot more. It compiles/saves fine. But when I insert a row, I get an error
#1630 - FUNCTION databasename.SUBSTRING does not exist. Check the 'Function ...
0
votes
2
answers
200
views
Using a WHERE colname NOT LIKE (select * from otherTable)
So in essence what im trying to do is this:
Given TBL1 (around 8,000 rows)
letters
abababa
bcbcbcb
cdcdcdc
and TBL2 (around 2,000 rows)
letters
ab
bc
I want to write a query to find every row in TBL1 ...
3
votes
1
answer
427
views
String Manipulation of the Result from Recursive CTE
Good afternoon everyone
I found just one post here within the last year about this, but it doesn't help my situation.
I have been working with MySQL and trying to improve my knowledge of recursive CTE....
2
votes
1
answer
440
views
Microsoft SQL Server - Get first n alphanumeric characters with variable length, meeting ABCD-1234 or ABCD-1234567 format
My MS SQL 2019 server version is 15.0.2080.9 (X64)
I have a table like
id
message
2003
ABCD-1234: some text
2897
ABCD-5678
2456
ABCD-675456: some text
3204
ABCD-4512345 :some text
4567
ABCD-2345
My ...
5
votes
2
answers
2k
views
At finding a substring, find the end position as well
A LIKE clause can test if a string occurs in another and the CHARINDEX function can give the start position of the first match.
In my case, I'm interested in the end position though, which is, due to ...
0
votes
3
answers
514
views
Finding duplicate letters in a string beginning and ending at certain positions in MariaDB?
I need to find all strings containing double letters in positions between 4th and 10th inclusive.
I can find all double letters by
'([a-zA-Z])\1{1,3}';
and positions by
SELECT SUBSTRING(columnmame, ...
0
votes
2
answers
2k
views
Extract/parse info between delimiters
I have a column where there are 10 "fields" separated by the pipe character, looks like this:
texthere | somemoretext | sometinghere | moreinfo | evenmorehere | etc |
etc |
I've been ...
2
votes
2
answers
550
views
Return part of a string with variable length
I have data in a table column like below:
host=0.0.0.0 port=5432 dbname=database_name user=pglogicaluser
host=0.0.0.0 port=5432 dbname=database_name2 user=pglogicaluser
I want to write a query to get ...
4
votes
2
answers
992
views
SQL join on an edited field
I'm trying to join Table1 and Table2 on the Url fields. However all the Urls in Table2 end with a "/" as per the example below:
Table1
╔═════════════════════╗
║ Url1 ║
╠═══════...
-1
votes
1
answer
445
views
Strange behavior with Quotename and substring [closed]
I am seeing some behavior that I cannot figure out. We have a sproc that joins a bunch of tables and filters down some pipe-separated (|) values in a column. We cross apply a string splitter (I ...
2
votes
1
answer
2k
views
Replacing a specific string in oracle
I've a database value 'INS. Company Cancelled' where multiple values are separated by '.'
I'm trying to replace 'INS' with 'INSEXP' my expected result is 'INSEXP. Company Cancelled'
I've tried below ...
1
vote
2
answers
2k
views
Mssql subquery inside a substring
I need to remove the last character of my subquery but I cannot figure out how to reference my subquery in the subselect as I need the length of it.
The subselect collects all rows and converts them ...
1
vote
2
answers
88
views
How to extract certificate attributes from a single column and split into many?
In my table I've a field (let say cert_attr) which stores Certificate X.509 Attributes.
Here is the example of 3 rows (each line corresponds to a field):
"CN=User1, OU=Eng, O=Company Ltd, L=D4, S=...
0
votes
1
answer
94
views
SQL Server 2008 - Replacing csv substrings in view-row using data from other table
Using SQL server 2008, is there a way to perform SELECT query in a view replaces a row containing comma-separated values with their corresponding text value from another table? STRING_SPLIT and ...
1
vote
1
answer
301
views
Mass update all cells in a column with a substring of it's original value
I need to trim the last seven characters off of all the cells in a column.
This query returns the results that I need
SELECT test_date, SUBSTRING(test_date FROM 1 FOR CHAR_LENGTH(test_date) - 7) as ...