Need to increment alpha field

  • I'm trying to increment the last character of an alpha value by one - but can't for the life of me figure out how to do it. I know how to use right('field',1) to get the single character - but don't know how to increment an alpha. Any help is greatly appreciated!

  • Please post the DDL for the table and some sample data in a readily consummable format that can be cut/paste/run in SSMS to load the table, and we'll see what we can do for you.

    Problems with this request, please read the first article I reference below in my signature block regarding asking for assistance and follow the instructs in the article.

  • I have seen this done typically in two ways (although I have never done it and can't speak to which is best).

    Option 1: Build a table with a int data type and char data type. Perform lookups against the table, increment the numeric int field and return the char value.

    Option 2: Convert the last field to ASCII and increment using that value. You will need to be aware of other characters so that you only do A-Z and dont include tabs, special characters, etc.

    hope it helps.... and I am sure there is another 10 ways to do it.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply