SQL Query

  • How can i remove the last two letters of every row in a column?

  • UPDATE Table SET col = LEFT(col, LEN(col) - 2)

    Ivan Budiono

  • Something like this should work, provided the column in question is varchar or nvarchar. If it doesn't do what you want, could you give us more details, including some sample data and desired output.

    Update MyTable Set SomeColumn = LEFT(SomeColumn, LEN(SomeColumn)-2)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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