update: there are situations that dot position that might not be the best solution. I got a column of website. I want to transform it into Anyone knows how to split based on the ‘.’ position from the right? Thanks. Answer regexp_substr() does exactly what you want:
Tag: string
Trimming the beginning and end of string in SQL
I have quite a long string that I want to trim the beginning and ending of. See a random example below: { “topic”: “birds”, “body”:”cool bird”, “attachment1″:”bird1”, “attachment2″:”anotherbird” } My desired output: “attachment1″:”bird1”, “attachment2″:”anotherbird” I want to keep the attachments so I would have to trim everything up to the first attachment “attachment1” and get rid of the ‘}’ as
Adding a dot in a string in sql
I need to add a dot in two strings of numbers. (example “88188741478”). I need to add it 8 characters before the end. The result should look like this “881.88741478”. I need …
Update Text Field on Multiple Rows Using Current Text In Field SQL
I have a table with a text field that imported with incorrect characters delimited by a space. Expected Output I need to run an update to remove all the text AFTER the space on a specific number of rows. I figured out a way to select the correct text, but I’m stuck on how to update in bulk. Will return
SQLite – order by numbers inside string
its my first post here, so bear with me. I’m trying to order a query by numbers in a specific row that contain letters, using SQLite. Example: “Winter 1993”. I want to be able to sort by the …
SQL case sensitive compare
I like to know with a CASE statement wether two fields are the same. I managed to do it with following query but I wonder if there is a better approach? I just want the ‘=’ to do a case sensitive …
finding if a line starts with a specified string in a clob and then extract
I have a CLOB column that I want to search for a line that starts with ‘305’ then extract something from that line, some of my rows will have multiple lines that start with ‘305’ or ‘305 somewhere in the entire cell, so I’d only want to find the first line where it starts with ‘305’ the entire cell content
How can I split a string into character in Snowflake?
I need to split a string like “abc” into individual records, like “a”, “b”, “c”. This should be easy in Snowflake: SPLIT(str, delimiter) But if the delimiter is null, or an empty string I get the full str, and not characters as I expected. Answer Update: SQL UDF I found this problem while working on Advent of Code 2020. Instead
How to have different values of a single column in a condition where in sql?
I write a SQL query to get different sales information about stores. The problem is that I would like to filter and take only some store numbers in my “GL_ETABLISSEMENT” column, if I just do …
How to escape it properly?
I have sql string written with template string syntax: I have problems with binding second param – $2 because of single quote. How should I write it properly ? Error: Error: Query failed: bind message supplies 2 parameters, but prepared statement “” requires 1 Answer I think you’re supposed to use wildcards this way: