Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert varchar into numerical value in sql
How to convert varchar into numerical value in sql
Numeric has several choices, such as plastic, decimal and so on. It's all implemented by cast

Premise: the ID field of table a is of VARCHAR type.

1. Select CAST(ID is an integer) from it.

2.select cast (id is decimal (18, x)) from a-x refers to decimal places. If you want to keep 2 decimal places, it is 2, and if you don't keep decimal places, it is 0.