Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 String Problems

Author  Topic 

wotrac
Yak Posting Veteran

98 Posts

Posted - 2003-05-18 : 11:19:03
Can Anyone tell me how to find the position of a comma ','
or a carriage return 'chr(13)' in a string.
As I need to find the position of both of these to return my query.


Paul

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-05-18 : 11:29:52
DECLARE @String NVARCHAR(100)

SELECT @String = 'Test 1, 2 3' + CHAR(13) + ' String After Return Carriage'

SELECT CHARINDEX(',',@String,1), CHARINDEX(CHAR(13),@String,1)

----------------------------
7 12


Go to Top of Page

wotrac
Yak Posting Veteran

98 Posts

Posted - 2003-05-18 : 13:23:02
Thanks that works a treat


Paul

Go to Top of Page
   

- Advertisement -