Mega Code Archive

 
Categories / MSSQL / String Functions
 

CHARINDEX

1> DECLARE @FullName VarChar(25), @SpaceIndex TinyInt 2> SET @FullName = 'www.rntsoft.com' 3> 4> -- Get index of the delimiting space: 5> SET @SpaceIndex = CHARINDEX('java', @FullName) 6> -- Return all characters to the left of the space: 7> SELECT LEFT(@FullName, @SpaceIndex - 1) 8> GO ------------------------- www. (1 rows affected) 1>