With this query I get the postal code from an address and it works, but there are some cases where the address number’s length is 5 and so I get this instead of the postal code, is there any chance to …
Tag: substring
Find a string inside a string and update in SQL Server
I have a table like this : I need to replace the string inside the tag c24 tag.. Excepted output: I need to replace the letter ‘G’ to be replaced with ‘T’ like this inside c24 tag – HT0010001 and all the rest should be same unchanged… What I tired: Answer If the code always begins with ‘H’, then I
How to substring non constant strings?
I have the following query: With this query I try to associate the value of substring to my variable NUMERO_ORDINE when I find the “NR.” string in the Text column. Sometimes I don’t have the “NR.” string, so this query doesn’t work and I get wrong values from substring function. How can I create the same substring when I don’t
How to get the part of a string after the last occurrence of certain character?
I would like to have the substring after the last occurrence of a certin character. Now I found here how to get the first, second or so parts, but I need only the last part. The input data is a list of file directories: Unfortunately this is the data I have to work it, otherwise I could list it using
Is there an elegant and efficient SQL way of listing all substring positions?
I have a text column in an sql database. My task is to find all occurrences of a given string in the texts, and list the character positions text by text (for backreference later in the application). …
Converting Varchar(200) to YYYY-MM-DD format in Teradata SQL
I have a Varchar like so: 23FEB2025 I am trying to convert it into a format like: 1994-02-23 or YYYY-MM-DD I have tried select cast (’23FEB2025′ as date format ‘yyyy-mm-dd’); and sel convert(date,’…
Remove character from dynamic string
I have a file with some junk values and i need to get rid of them while loading that file into a table. Giving here some example. File is semicolon separated, and last column has those junk values. …
Converting NVARCHAR to INT after SUBSTRING using CHARINDEX and LEN
I am trying to join two tables using UI’s but the UI in one of the tables has ‘CLIENT_’ before it. When trying to remove the ‘CLIENT_’ from the string and then compare the UI’s I am getting the …
How to do sub-string calculations in SQL?
I am working with a table full of customer online orders. Each order has a company code which can be either ’09’, ’07’, ’04’, ’03’, and ’01’. Each order has an order number that looks something like …
Dynamic Extraction of text – SQL
I have a column with values in the following format: Successfully refunded 1 units of product 11111111 Successfully refunded 1 units of product 22222222 Successfully refunded 1 units of product …