如何将SQL输出传输到Excel而不会丢失前导零? [英] How to transfer SQL output to Excel without losing leading zeros?

查看:48
本文介绍了如何将SQL输出传输到Excel而不会丢失前导零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这是一个适合这个问题的论坛。

I hope this is an appropriate forum for this question.

我不是那个编程的人,我是代表另一个开发人员问的。

I am not the one programming this, I'm asking on behalf of another developer.

我们的网络网络应用程序中有很多报告。它们都是来自sprocs的输出。我们需要Excel中的输出。

We have a number of reports in our dot net web application. They are all output from sprocs. We need the output in Excel.

目前,开发人员正在使用一些通过CSV文件移动数据的技术。如果这会产生影响,则会在MVC中编码。

Currently the developer is using some technique that moves the data via a CSV file. This is coded in MVC if that makes a difference.

但是发生的事情是许多列都删除了前导零。
这对我们的用户来说是完全不可接受的。

But what is happening is that many columns are having leading zeros removed. This is completely unacceptable to our users.

我们需要一个不会剥离前导零的通用解决方案。我们希望解决方案不要求我们对单个报告列采取特殊操作,因为我们希望此解决方案允许通过简单地添加新的报告来添加新报告。

We need a general solution that does not strip off leading zeros. We prefer the solution does not require us to take special actions for individual report columns, since we want this solution to allow adding new reports by simply adding a new sproc.

有没有人有任何想法如何实现这一目标。我们的截止日期截止日期为12月29日。

Does anyone have any ideas how this can be achieved. We have a very tight deadline of Dec 29th.

感谢您提供任何建议。

推荐答案

如果是Excel的CSV文件目前如下所示:

  
00123,00456,00789

   00123,00456,00789

然后考虑不同的格式:

  
=" 00123",=" 00456",=" 00789"

   ="00123",="00456",="00789"


这篇关于如何将SQL输出传输到Excel而不会丢失前导零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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