简体   繁体   中英

How to change input type in orientdb

I have a class with name "employee" , in that class i have a property named "salary" with input data-type string. So, my question is can i change input data-type of "salary" from string to integer ? and if yes then how ?

I used this code to reproduce your problem

create class employee extends v
create property employee.salary string

insert into employee(salary) values ("1")

在此处输入图片说明

I used this query to changed the type of property salary

create property Employee.salary2 Integer
update employee set salary2=salary
DROP PROPERTY Employee.salary
update Employee remove salary
ALTER property Employee.salary2 name salary
update Employee remove salary2

在此处输入图片说明

Hope it helps

In newer versions of OrientDB you can use ALTER PROPERTY Employee.salary TYPE Integer

Works for me on 2.1.19

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM