You can translate the question and the replies:

Converting the text data type into an integer data type

Hi there, I'm trying to convert a field of data type 'text' to 'integer' in denodo. The below is my sample operation. ***select column1, column2, column3 from bv_sample order by cast(field1 as integer) ;*** I get the below error: **"Error converting data type varchar to numeric"**

3 Answers

Hi, I was able to obtain the expected results successfully without any error by using cast function to convert the text data type to integer data type. For more details, you can refer to [CAST](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/appendix/syntax_of_condition_functions/type_conversion_functions#cast) section of the Virtual DataPort VQL Guide. Also, for more information about error, I would check the vdp.log file located in <DENODO_HOME>/logs/vdp folder. If you still need help and if you are a valid Support User, you may open a Support Case at the Denodo Support Site and the Support Team will help you. Hope this helps!
Denodo Team
06-08-2020 07:21:56 -0400
code
Sometimes the cast operation works and some times it fails. Could it be related to something other than this.?
user
01-09-2020 12:08:24 -0400
Hi, In order to use cast function, I would make sure I am using correct syntax to meet my requirement. Also, I would refer to [Type conversions permitted with the CAST function](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/appendix/syntax_of_condition_functions/type_conversion_functions#type-conversions-permitted-with-the-cast-function) section of the Virtual DataPort VQL Guide. For Example: `cast('double', round((field1/field2), 10))` Hope this helps!
Denodo Team
14-09-2020 08:50:46 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here