user950898
user950898

Reputation: 31

How to copy a Postgresql varchar column to an integer column

I have a postgresql table named baseballs with a column named quantity of type = varchar and would like to populate the quantity_integer column with type = integer

How would I write a SQL statement?

Upvotes: 3

Views: 2649

Answers (1)

Bohemian
Bohemian

Reputation: 425238

update baseballs set quantity_integer = quantity::int;

Upvotes: 9

Related Questions