March 27, 2003 at 4:04 am
Does anyone know how I can match a newline or tab character using PATINDEX?
March 27, 2003 at 4:49 am
Use the char function:
patindex(@value,char(9)) - tab
patindex(@value,char(13)) - newline
I think new line is 13 but it might be carriage return which might be slightly different. Use select ascii(@value) to determine actual value but cut and paste required text into @value.
Jeremy
March 27, 2003 at 10:23 am
March 27, 2003 at 12:26 pm
Actually, in ASCII 13 is carriage return, and 10 is new line (or line feed). They're usually paired together, but have seen some systems/files use only one or the other.
Jay Madren
Jay Madren
March 27, 2003 at 12:47 pm
Yes, newline is usually used to mean line feed (10) + carriage return (13), though newline is really just a synonym for line feed. So the question is which you are looking for singhster. I guess you probably mean any one of the two, so you need to look for both with patindex, plus tab of course.
--
Chris Hedgate @ Apptus Technologies (http://www.apptus.se)
March 28, 2003 at 9:36 am
I was after a char(13) after all.
In the end I used
PATINDEX ('%' + char(13) + '%',@SPText)
and it produced the results I expected.
Thanks for all the help folks!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply