Convert Text to Numbers in SQLite

Sqlite

Sqlite Problem Overview


I have a sqlite DB with a table with the following structure LocationName Latitude Longitude all defined as varchar. How i can construct a sql statement to get all the locations with a specific lat range given latitude in decimal. is there a way to do that convert from varchar to decimal value on the fly ? or i have to step through the return statements and do the conversion manually

Sqlite Solutions


Solution 1 - Sqlite

See "CAST expressions" at http://www.sqlite.org/lang_expr.html.

SELECT CAST('3.02' as decimal)
-- they aren't real decimals in sqlite, though. beware floats.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser519274View Question on Stackoverflow
Solution 1 - SqliteAnton KovalenkoView Answer on Stackoverflow