Monday, March 26, 2012

How to get the position of a character in a column/String

Hi, I want to substring a part from a column, and for that I need the position of a defined character within the string, for example, I want to know the position of '#':

String: TEst#test2

So I want to know the position from # in the String

Is that possible?

Quote:

Originally Posted by JPete

Hi, I want to substring a part from a column, and for that I need the position of a defined character within the string, for example, I want to know the position of '#':

String: TEst#test2

So I want to know the position from # in the String

Is that possible?


Yes, it it CHARINDEX: SELECT CHARINDEX('#',' TEst#test2')

No comments:

Post a Comment