About 252,000 results
Open links in new tab
  1. Charindex() functionality in SQL Server - Stack Overflow

    Oct 17, 2015 · CHARINDEX ( expressionToFind , expressionToSearch [ , start_location ] ) expressionToFind A character expression containing the sequence to find. expressionToFind …

  2. How to use Charindex for one or the other character

    3 I have a string with a bunch of numbers but it contains one letter somewhere in the center of the string. This letter can either be 'A' or 'B'. I am trying to find out the position of this letter with the …

  3. Find index of last occurrence of a sub-string using T-SQL

    Jun 22, 2009 · Is there a straightforward way of finding the index of the last occurrence of a string using SQL? I am using SQL Server 2000 right now. I basically need the functionality that the …

  4. sql - Substring, Charindex - Stack Overflow

    May 18, 2017 · I'm trying to extract a code that varies in length that exists after the first two underscores and before the third underscore in a field in a table. The table looks something …

  5. Trying to extract text using CHARINDEX ()- 1 but getting an error

    Jun 27, 2021 · SELECT [Name] --,LEFT([Name], CHARINDEX(' ', [Name])) AS FirstName ,SUBSTRING([Name], 1, CHARINDEX(' ', [Name] )) AS FirstName FROM …

  6. How to use multiple CHARINDEX function in SQL Server?

    Jul 11, 2018 · How to use multiple CHARINDEX function in SQL Server? Asked 7 years, 6 months ago Modified 7 years, 6 months ago Viewed 19k times

  7. Using CHARINDEX() in T-SQL to select a part of a nvarchar value

    Jun 5, 2024 · You're passing -1 as the third argument to charindex, which means the search will start from the -1st character of the string, which is meaningless, and just treated as the first …

  8. SQL Server - find nth occurrence in a string - Stack Overflow

    Jan 4, 2012 · A similar User defined function could be written to achieve this. Example in the Alternatively you could use charindex function call it x times to report the location of each _ …

  9. How do I use SUBSTRING and CHARINDEX in SQL to return only …

    Jan 2, 2020 · How do I use SUBSTRING and CHARINDEX in SQL to return only the right part of a field contained within brackets if multiple brackets are in the field?

  10. Getting the second occurrence from charindex function in sql server

    Apr 10, 2019 · I need to get the second occurrence of the space for below text. It should be the space after the 56, but I'm getting 15th position before the 56 as the first one. select …