Skip to main content

Questions tagged [substring]

The SUBSTRING function is used to return a portion of a string.

-1 votes
2 answers
85 views

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 ...
Rohit Gupta's user avatar
  • 2,168
0 votes
2 answers
200 views

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 ...
Shahzad Ansari's user avatar
3 votes
1 answer
427 views

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....
nicodemus's user avatar
2 votes
1 answer
440 views

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 ...
Ramakrishnan Srinivasan's user avatar
5 votes
2 answers
2k views

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 ...
John's user avatar
  • 775
0 votes
3 answers
514 views

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, ...
Bluetail's user avatar
  • 103
0 votes
2 answers
2k views

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 ...
bravo4one's user avatar
  • 101
2 votes
2 answers
550 views

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 ...
Sayad Xiarkakh's user avatar
4 votes
2 answers
992 views

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 ║ ╠═══════...
neptr's user avatar
  • 43
-1 votes
1 answer
445 views

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 ...
scarr030's user avatar
  • 115
2 votes
1 answer
2k views

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 ...
Aravind's user avatar
  • 193
1 vote
2 answers
2k views

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 ...
Symbiose Studios's user avatar
1 vote
2 answers
88 views

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=...
kenorb's user avatar
  • 475
0 votes
1 answer
94 views

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 ...
zenith's user avatar
  • 3
1 vote
1 answer
301 views

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 ...
Chaostime's user avatar

15 30 50 per page
1
2 3 4 5