Update - Conversion Error

djlysuc

Registered User.
Local time
Today, 12:55
Joined
May 22, 2006
Messages
11
I have a text column of alpha-numeric fields and some start P123456, P111111, P222222 etc. I want to remove the P from these fields.

I thought the following update query would do this but gives a type conversion error, regardless if the new column to copy them to is type text or number. Can someone help explain what is wrong.

Code:
UPDATE 2006 SET D2 = CLng(RIGHT(D1,LEN(D1-1)))
WHERE LEFT(D1,1)="P";

Thanks,
Andy
 
UPDATE 2006 SET D2 = RIGHT([D1], LEN([D1])-1)
WHERE LEFT(D1,1)="P";
.
 
Thanks Jon, I can see my stupid mistake now!
 

Users who are viewing this thread

Back
Top Bottom