使用Str函数Sql查询未排序我无法理解它是如何完成的 [英] Using Str Function Sql Query Is Not Sorted I Can't Understand How It Be Done

查看:79
本文介绍了使用Str函数Sql查询未排序我无法理解它是如何完成的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有sql查询我想对数据进行排序但由于str功能它无法正常工作。如果我删除了str函数,它会给我一个错误,即将数据类型nvarchar转换为数字时出错。

所以帮助我需要做什么。请帮助

i have sql query i want to sort the data but due to str function it's not working.If i removed str function it gives me error that Error converting data type nvarchar to numeric.
so help me what i have to do.please help

推荐答案

通常,当数据库中存储非数字值时会发生此错误。最好的办法是将查询减少为SIMPLE查询:从表中按x选择x;你仍然得到错误的地方。我看过空格或格式错误的数字:。0或1e5值会导致出现此类错误消息。如果它只是失败的顺序(我上面没有看到,因此请求更简单的查询),有时您可以按to_number(regex_replace(to_string(value)))的顺序对其进行编码 - 将其归结为just数字并确认它是坏人物。然后,你可以创建WHERE子句来查找导致问题的数据,并找出解决问题的最佳方法。
Typically this error happens when there are non-numeric values stored in the database. Your best bet is to reduce the query to a SIMPLE query: Select x from TABLE order by x; where you still get the error. I have seen spaces or just badly formatted numbers: ".0" or "1e5" values cause this kind of error message. IF it is only the order by that fails (which I do not see above, hence requesting a simpler query), sometimes you can code it as order by to_number(regex_replace(to_string(value))) -- to get it down to just numbers and confirm it is bad characters. THEN from there, you can create the WHERE clause to find the data causing the problem, and figure out the best way to deal with it.


我认为你试图用这个来连接货币数字数据

这是一个简单的前端作业,只需将货币创建为单独的列,并根据需要订购数字数据。

在前端加入具有所需列的货币
i think you are try to concat the currency with the numeric data
this is a simple front end job, just create the currency as a separate column, and order the numeric data as you want.
in front end just join the currency with the required columns


这篇关于使用Str函数Sql查询未排序我无法理解它是如何完成的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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