I have a column of values where some values contain brackets with text which I would like to remove. This is an example of what I have and what I want: I have only come across approaches that use the number of characters or the position to trim the string, but these values have varying lengths. One way I was
Tag: substring
Get Substring between two characters in SQL Server query
I want to get the string between two characters in the following string: I want to get the text between the @ and the SPACE after the @ which results in user1, is there a way to do this? There could even be 2 or more @ which I will need to extract like here is a table-like example: Sample
How to parse a string and get the value after “=” character
So I have string that should contains “Object.Name” once in a row , if I see it ,I have to get the value after “=” character. If doesn’t match it anywhere in the string i should move hardcoded value. Here is example of the string: I know that I should use case for that but doesn&…
Snowflake Regular Expression
I have this string in Snowflake column: I need to get names in this format regardless of the number of company names: “SpecTra, Signal Capital Partners”. In other words, I need to extract company names and concatenate them. I have tried this : and regexp_substr() function, but did not get the desi…
Check digit constraint in SQLite
I’m trying to create a constraint for an id (5 digits in length) where the 5th digit is the last digit of the value (1 x d1 + 3 x d2 + 1 x d3 + 3 x d4). For instance, if the first four characters of the id are 1234, then the fifth digit is the last digit of
Error: SQL Substring with the “ON” Part of the JOIN
I am using PostgreSQL and must join tables using substring. As I demonstrated below, xyz.MODEL and first three characters of “columnname” from abc Table should match. However, the query below does not work. It returns the error: Can anyone help me to correct this query? Thanks for your help alread…
Substring to Get value only after first occurrence of : in Oracle SQL
I have data in below format in an Oracle table column: I want to have data in below format i.e to have distinct first string after first occurrence of :: I can get the value for first record using below query But I am unable to get it for others if there are more than one : in a column
adding trimmed substrings
using sql server: I have a number of commands that trim a txt file, example: Case when charindex(‘-‘, Substring([RawStreamOut], 179, 10)) > 0 then ‘-‘ + Replace(LTrim(RTRIM(…
Fetch a set of words(char and non char seperated by space) from a sentence appearing prior to a particular words in Oracle Sql
I want to split a sentence and fetch a subset of words seperated by space , prior to a specific word in Oracle SqL. I tried regexp substring, instring but couldn’t arrive at solution. Source …
Extract the second word from a string in ODI Expression
This two syntaxes allow to get the scond word from a string in oracle Result: I’m working in ODI (oracle data integration), this two syntaxes doesn’t work in ODI: For ODI, the regexp is not valid and INSTR function accepts only 2 parameters Can you suggest me a solution that can work in ODI? Thank…