November 12, 2007 at 7:43 am
i've got a query which pulls against one column, and
displays something like this:
bla bla bla XYZ yatta yatta text text text etc...
how would i get it to display only every thing after the letter 'Z' ??
i've tried select left (column, #), but that doesn't work
cause there are different amount of characters before
'Z' in many other records.
any ideas?
_________________________
November 12, 2007 at 7:51 am
Use CHARINDEX function.
November 12, 2007 at 8:13 am
i'm probably too inexperienced to understand charindex.
after looking through bol, i'm not sure it will get what i need.
maybe what i need is a quick example.
i want all the records returned in MyColumn, but only
display every thing to the right of the letter 'Z'.
all the stuff before it i need cut off.
does that make sense?
_________________________
November 12, 2007 at 8:23 am
declare @string varchar(2000)
select @string = 'bla bla bla XYZ yatta yatta text text text etc...'
select substring(@string, charindex('Z', @string) + 1, len(@string))
November 12, 2007 at 8:26 am
I think by "a quick example" you mean you want us to do all the work for you. You've been posting here for a long time so I don't believe you're really inexperienced. Here's a hint: use CHARINDEX to get the position of the Z, then use the RIGHT function to extract everything after that.
John
November 12, 2007 at 8:48 am
thanks for all the good feedback 🙂
fyi;
this account is shared between a few of us here at the office. i'm more
of a front end applications guy, but there are a couple other people
here that are more sql savy than i am. they tell me to feel free to use
this site whenever.
_________________________
November 12, 2007 at 9:49 am
Hi kid,
why don't you get your own login?
We will gladly help you as an individual person. It is difficult to help when we don't know who exactly is behind a login today for a particular login because when answering we assume the certain level of knowledge which is different for each person.
Regards,Yelena Varsha
November 12, 2007 at 11:43 am
Yelena Varshal (11/12/2007)
Hi kid,why don't you get your own login?
+1 The price is right
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply