About 491,000 results
Open links in new tab
  1. sql server - How to get first character of a string in SQL? - Stack ...

    Aug 8, 2016 · SUBSTRING ( MyColumn, 1 , 1 ) for the first character and SUBSTRING ( MyColumn, 1 , 2 ) for the first two.

  2. SQL Server SUBSTRING() Function - W3Schools

    Extract 3 characters from a string, starting in position 1: The SUBSTRING () function extracts some characters from a string. Required. The string to extract from. Required. The start …

  3. SUBSTRING (Transact-SQL) - SQL Server | Microsoft Learn

    Apr 16, 2025 · The SUBSTRING function returns a portion of a specified character, binary, text, or image expression.

  4. sql - How do I remove the first characters of a specific column in …

    If you have to remove the first few characters that are preceded by a special character like #, this is a good one: UPDATE tblInvalidID SET [ColumnName] =stuff(ColumnName, 1, charindex('#', …

  5. SUBSTRING, PATINDEX and CHARINDEX string functions in SQL

    Mar 1, 2021 · In this article, we explore SUBSTRING, PATINDEX, and CHARINDEX using examples. The SUBSTRING () function extracts the substring from the specified string based …

  6. SQL SUBSTRING Code Examples and Usage - MSSQLTips.com - SQL Server

    May 10, 2023 · The SQL Server SUBSTRING function extracts a portion of a string based on its starting position and length. The syntax for the SUBSTRING function is as follows: …

  7. Extract the first word of a string in a SQL Server query

    Apr 1, 2009 · Extract the first word from the indicated field: SELECT SUBSTRING(field1, 1, CHARINDEX(' ', field1)) FROM table1; Extract the second and successive words from the …

  8. How to Get First Character of a String in SQL? - GeeksforGeeks

    Dec 5, 2024 · In this article, we will explain how to extract the first character of a string in SQL using two popular methods: the SUBSTRING () and SUBSTR () functions. We'll provide …

  9. SUBSTRING () Function in SQL Server — Syntax and Examples

    Feb 28, 2025 · One of the simplest use cases for SUBSTRING () is extracting text from a literal string. Here’s an example: Start Parameter: The function begins at position 1 (the first …

  10. How to Extract a Substring From a String in T-SQL

    The argument column is the column from which you'd like to retrieve the substring; it can also be a literal string. The third argument of the SUBSTRING() function is the length of the substring. …

Refresh