'Break down versions into an integer - SQL

I'm trying to break down versions into integers.

for example, from 14.4 to 14 or from 9.4.1 to 9

How can I define the number until the dot?

Thanks.



Solution 1:[1]

you can try SPLIT_PART https://docs.snowflake.com/en/sql-reference/functions/split_part.html

select Split_part(column1,'.',0) col1 from values ('14.4') ,('9.4.1') , ('12345.5656')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Himanshu Kandpal