I need to export data from Sql Server 2008 to Excel/CSV file.

I have two options for that:

  • OPENROWSET
  • BCP

Which will be better options if amount of data is large and security is concern?

有帮助吗?

解决方案

There are some good comments on a similar question here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=147861.

My leaning would be towards BULK INSERT, but really the best thing you can do is try it both ways. Then you'll be able to compare which is faster and you'll have a better understanding of which will fit your security concerns better since you'll then know what security issues you had to address to make it work.

Edit: You are trying to export, so obviously BULK INSERT won't work. BCP would be your more performant choice I believe, and besides I think it's your only choice if you want to do a bulk export. I'm pretty sure OPENROWSET only allows for bulk imports into sql, but not exports.

See: http://msdn.microsoft.com/en-us/library/ms175937.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top