如何将SQL Server 2005查询导出为CSV [英] How to export SQL Server 2005 query to CSV

查看:124
本文介绍了如何将SQL Server 2005查询导出为CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些SQL Server 2005数据导出为CSV格式(带引号的逗号分隔).我可以想到很多复杂的方法,但是我想以正确的方式进行.我已经看过bcp了,但是我想不出如何将引号引起来(除了将它们连接到字段值上,这很丑).我想我可以用sqlcmd和-o做到这一点,但是出于相同的原因,这看起来很丑.

I want to export some SQL Server 2005 data to CSV format (comma-separated with quotes). I can think of a lot of complicated ways to do it, but I want to do it the right way. I've looked at bcp, but I can't figure out how to put the quotes around the fields (except concatenating them to the field values, which is ugly). I guess I could do it with sqlcmd and -o, but that seems ugly for the same reason.

是否有bcp方式?

是否存在合理的sqlcmd方法?

Is there a reasonable sqlcmd way to do it?

我只是忽略了Management Studio中内置的一些很棒的简单实用程序吗?

Is there some great, simple utility built into the Management Studio that I'm just overlooking?

推荐答案

在Management Studio中,选择数据库,右键单击并选择Tasks->Export Data.在那里,您将看到导出为各种格式的选项,包括CSV,Excel等.

In Management Studio, select the database, right-click and select Tasks->Export Data. There you will see options to export to different kinds of formats including CSV, Excel, etc.

您还可以从查询"窗口中运行查询,并将结果保存到CSV.

You can also run your query from the Query window and save the results to CSV.

这篇关于如何将SQL Server 2005查询导出为CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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