Search results
15 kwi 2014 · select REVERSE(substring(REVERSE(@temp),0,CHARINDEX('-',REVERSE(@temp),0))) Give this a shot. It answers your first question of extracting from after the last - of the string. The next part of your question seems to indicate that you want to split the entire thing up based on the -.
28 lip 2021 · Find texts starting, ending or containing a given string. How to select rows where a text column starts by, ends by, or contains a string. Including slightly less trivial cases.
21 cze 2015 · if you want to find name end with something like 'test' use => select name from table where name like '%test'. if you want to find name start with s and end with h use => select name from table where name like 's%'and name like '%h' or simply select name from table where name like 's%h'.
9 gru 2014 · I need to compare the end of strings against a list of possible ending in a stored procedure. It will be called a lot and there are around 10-15 candidate endings. At this point a code-only solution is preferable to creating tables dedicated to this. Something that would be like: IF (ENDSWITH(@var, 'foo') OR.
5 lip 2012 · To replace from the start of the string, you could either filter using LIKE or if that isn't appropriate to your query, use CASE, SUBSTRING and CHARINDEX to conditionally do the replacement
You can use stuff(): select left(field, 25), stuff(field, 1, 25, '') The problem is that substring() doesn't accept a negative length, which your code calculates. answered Jan 21, 2021 at 16:38. Gordon Linoff.
T-SQL allows also remove space of another characters only from the beginning or only from end of a string. The example below removes the space at the end of each company by using RTRIM() function. SELECT RTRIM(name) AS new_name FROM company;