Results 1 to 2 of 2

Thread: How to find the (nth) place of a character in a word.

  1. #1
    Mustafa Coruh Guest

    How to find the (nth) place of a character in a word.


    I just would like the find out the n th number of the character.
    Such as, if a have 123456.xx, word.3 in a column, what is the numberth of the "." in each word. On the first one is the seventh and on the second one fifth.

    Is there any function in T-SQL that I can find the nth place of a character?

    Thanks a lot.

  2. #2
    alberto Guest

    How to find the (nth) place of a character in a word. (reply)


    select charindex('.',"word.3&#34


    syntax : charindex(chartofind,"column or word&#34
    where

    chartofind and column or word is character, so your first value which is a number must be converted to string, it could be like this:

    select charindex(varchar(64),123456.00))


    cheers.


    ------------
    Mustafa Coruh at 8/8/01 9:28:28 PM


    I just would like the find out the n th number of the character.
    Such as, if a have 123456.xx, word.3 in a column, what is the numberth of the "." in each word. On the first one is the seventh and on the second one fifth.

    Is there any function in T-SQL that I can find the nth place of a character?

    Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •