Hello,
I'm trying to get numbers in some text after a -.
Here is how the text is formated:
D##-###.
So like an example would be: D14-013
I thought this query would get that last bit:
SELECT Replace(GPCL_Asset_ID,'D%-','') AS Expr1
FROM Assets
WHERE Assets.GPCL_Asset_ID Like 'D%' AND Assets.GPCL_Asset_ID NOT Like '%IH%';
However it returns the text as it was (i.e. D14-013 instead of 013).
I'm not sure how to approach this. I thought that this would be the best approach.
My ultimate goal is to find the largest number after the -.
So it end up like:
SELECT Max(CInt(Replace(GPCL_Asset_ID,'D%-',''))) AS Expr1
FROM Assets
WHERE Assets.GPCL_Asset_ID Like 'D%' AND Assets.GPCL_Asset_ID NOT Like '%IH%';
Any help would be appreciated.
Thank you in advance.
Edit: I could do Right(GPCL_Asset_ID, 3). But I'm trying to also account for the possibility it becomes four digits long.