stripping numeric text out of a field

  • adding a left function in there works for me. Since there is always one single quote at the end I can leave it hard coded.

    Declare @TestData varchar(29)

    Set @TestData = (SELECT DISTINCT(PRIMARYKEY) FROM vAUDITTableChanges WHERE PRIMARYKEY = ("iFuturePriceID=N'4194582'"))

    Select left(

    Substring(@TestData, patindex('%[0-9]%', @TestData), Len(@TestData)),

    len(Substring(@TestData, patindex('%[0-9]%', @TestData), Len(@TestData)))-1)

Viewing post 16 (of 15 total)

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