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 2005 Forums
 Transact-SQL (2005)
 Determine position of a character in a string

Author  Topic 

donchamp
Starting Member

9 Posts

Posted - 2010-07-03 : 18:25:30
Help-I have variable length character string. I need to set a numeric value of another column based on the position of the last character in the string.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-03 : 18:30:44
The last character's position will be equal to DATALENGTH function, so you can use that to update the other column.

Or maybe you are looking to find a specific character, if so then use CHARINDEX. You should also lookup PATINDEX.

If that's not what you want, then please show us a data example to make it more clear.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -