string - I cannot understand why charindex is not working -
i baffled......
can tell me why
charindex('\', reverse('test\henrov')) char1, charindex('\', reverse('test\henrov'))-1 char2, len(right('test\henrov', charindex('\', reverse('test\henrov'))))-1 test, right('test\henrov',6) [ok], right('test\henrov', charindex('\', reverse('test\henrov'))-1) [also_ok]
works ,
charindex('\', reverse(m.username)) char1, charindex('\', reverse(m.username))-1 char2, len(right(m.username, charindex('\', reverse(m.username))))-1 test, right(m.username,6) [ok], right(m.username, charindex('\', reverse(m.username))-1) [not_ok]
does not work? m.username varchar contains 'test\henrov'.....
i error: invalid length parameter passed right function.
stupid! found solution here:
sql charindex throwing invalid length parameter passed left or substring function because of period?
right(m.username, charindex('\', reverse(m.username) +'\' ) -1) [ok_yes]
Comments
Post a Comment