sqlite将文本转换为数字 [英] sqlite Convert Text to Numbers

查看:1163
本文介绍了sqlite将文本转换为数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有以下结构的表的sqlite数据库LocationName Latitude经度全部定义为varchar。我如何构造一个sql语句来获得具有特定纬度范围的所有位置给定纬度为十进制。有没有办法在运行中将varchar转换为十进制值?或者我必须单步执行返回语句并手动执行转换

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

推荐答案

请参阅 http://www.sqlite.org/lang_expr.html

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

这篇关于sqlite将文本转换为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆