in results... display everything after a certain character??

  • 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?

    _________________________

  • Use CHARINDEX function.

  • 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?

    _________________________

  • 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))

  • 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

  • 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.

    _________________________

  • 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

  • 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