Delete 1st character in a String

  • I need to strip off the first character of an incoming string in a proc.

    follows like this:

    'G13223434' incoming parameter

    I need to strip of the G in order to use it in the WHERE clause of my proc.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

  • Try this on. I use the patindex to make sure I actually need to strip the first digit/character.

    declare @STR varchar(20)

    set @STR='a12345'

    select @STR=substring(@str,2,len(@str)) where patindex('%[0-9]%',@str)>1

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Perfect. Thanks a lot:D

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

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

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