ssms查询结果毫不零,对于浮点列而没有零
我将使用SQLCMD的SSMS查询结果导出到.csv文件,使用Shell脚本。但是,如果表中的任何列是浮动的,则将其结果为123.0而不是123。当我在SSM中执行相同的选择查询时,它是123。如何获得在SSMS结果中显示的相同值。而且我不能将cast/Convert用于该特定列,因为我要为多个表导出结果
I am exporting SSMS query result with SQLCMD to .csv file using shell script. But if any of the column in a table is float, it is resulting as 123.0 instead of 123. When I execute the same select query in SSMS, it is 123. How can I get the same value which is showing in SSMS result. And I can't use cast/convert for that particular columns since I am going to export result for multiple tables
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为SSM本身用于显示目的,而
sqlcmd
不是。请让我们查看一些代码,尤其是因为您说您不能使用转换。
您可以将查询中的值转换,也可以保留原始内容,类似的内容:
此外,这可能与您有关:在这里
That's because SSMS itself rounds floating point values for display purposes while
sqlcmd
is not.Please let us see some code, especially because you're saying that you cannot use convert.
you could convert the value in your query, and also keep the original, something like this:
Besides that, this might be relevant for you: here