我怎样才能在sql中搜索Nvarchar值...? [英] How can i search Nvarchar value in sql ...?

查看:120
本文介绍了我怎样才能在sql中搜索Nvarchar值...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在搜索物质的长度值,即物品价值



纬度LIKE'%'+ @纬度+'%'和经度LIKE' %'+ @经度+'%'

但是lattitude,longtude数据类型是nvarchar所以在搜索数据类型时遇到一些问题是navrchar但是我输入了浮点值....?

什么是替代数据类型而不是'like'

解决方案

摆脱存储格式化为字符的数值的废话!使用适当的数字类型(带符号,带一些小数位)。

然后您的比较可能是例如

  WHERE (纬度 BETWEEN   12   AND   13  AND (经度 BETWEEN   78   AND   79 


Hi I am searching lattitude,longtude values in where condition i.e

Latitude LIKE '%'+@latitude+'%' and Longitude LIKE '%'+@Longitude+'%'
but lattitude,longtude datatypes is nvarchar so getting some problems in searching the data type is navrchar but I entered float values ....?
what is the alternate datatype instead of 'like'

解决方案

Get rid of the nonsense of storing numerical values formatted as characters! Use an appropriate numerical type (signed, with some decimal places).
Then your comparison could be e.g.

WHERE (Latitude BETWEEN 12 AND 13) AND (Longitude BETWEEN 78 AND 79)


这篇关于我怎样才能在sql中搜索Nvarchar值...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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