Changing the Field Type with a procedure

I want to add a field to theTargetDatabase and then set its field type using a procedure. I have tried the following code, which adds the field but does not change the type. (The code is running in a separate database.) Can anyone help?

setactivedatabase "theTargetDatabase"
addfield "ID"
field "ID"
setfieldproperties initializedictionary("TYPE","Integer")

Instead of setfieldproperties use fieldtype to change the data type of the current field.

That worked! Thanks.