Much easier than
Code:
SELECT Right([MyField], (Len([MyField]) - 3)) As NewNumber FROM ...
is simply
Code:
SELECT Mid([MyField], 4) As NewNumber FROM ...
But he says he wants to create a
NEW FIELD with those values and *ONLY* get those that have
numbers after the period.
And I *assume* that the new field will be an integer.
SO....
First, add the new field:
Code:
ALTER TABLE tablename ADD thNumbersOnly INT NULL
And then use UPDATE to put in all the valid valuse:
Code:
UPDATE tablename
SET thNumbersOnly = CLNG( MID( thField, 4 ) )
WHERE ISNUMERIC( MID( thField, 4 ) )
That's not perfect. If he has a field with a value such as
th.123456789012
then the number there is too large for an integer field and he'd get an error. Or if there is a field with the value
th.1.2E22
then "1.2E22" passes the ISNUMERIC test but of course is way too large to be an INT value.
But I'd bet it would work in a real DB situation.