To get the starting position of a character that you might be looking, there is in SQL a function called CHARINDEX that will give you just that.
Example:
SELECT CHARINDEX(' ', [ContactName]) AS PositionOfWSInContactNameFROM [Northwind].[dbo].[Customers]This will return to you the position where the white space begins in a column.
The Syntax is:
CHARINDEX ( expression1 , expression2 [ , start_location ] )
expression1 - An expression that contains the sequence of characters to be found
expression2 - An expression that is typically a column searched for the specified sequence
start_location - Not necessary - The character position from which to start searching forexpression1 in expression2. If start_location is not given, is a negative number, or is 0, the search starts at the beginning of expression2.
Example:
SELECT CHARINDEX(' ', [ContactName]) AS PositionOfWSInContactNameFROM [Northwind].[dbo].[Customers]This will return to you the position where the white space begins in a column.
The Syntax is:
CHARINDEX ( expression1 , expression2 [ , start_location ] )
expression1 - An expression that contains the sequence of characters to be found
expression2 - An expression that is typically a column searched for the specified sequence
start_location - Not necessary - The character position from which to start searching forexpression1 in expression2. If start_location is not given, is a negative number, or is 0, the search starts at the beginning of expression2.