UPDATE trouble

  • I'm almost embarrased to ask : but why would

    Update SWBTPB_format Set CityState = Left(CityState, Len(CityState)-2)

    not work? The latter gives me the following error: "Invalid length parameter passed to the substring function." I have tried using various parens around the len statements, and have done other testing. If I remove the "-2" from the equation, it works fine.

    Any help is appreciated!! Thanks!

    Edited by - Rachel on 04/08/2002 3:38:28 PM

  • You have a record with a Len(CityState) Less than 2 and is returning a negative number. Try this

    Update SWBTPB_format Set CityState = CASE WHEN Len(CityState) < 3 Then CityState

    ELSE Left(CityState, Len(CityState)-2)

    END

    This will check the length before trying to knock it down to make sure will not come up negative.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • You were absolutely correct. It must be late in the day for me, at least that is what I will tell myself.

    Thank you again for your help!!

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

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