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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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