We help IT Professionals succeed at work.
Get Started

MSSQL 2005 export SQL query result to CSV (not xp_cmdshell etc)

Last Modified: 2021-04-21
I thought i'd found the perfect solution:

EXEC sp_addlinkedserver TextOut,
            'Jet 4.0',
DELETE FROM TextOut...table1#csv
select top 10 *
INTO TextOut..table1#csv
from backoffice_feed
EXEC sp_dropserver 'TextOut'

But it's not supported in 64bit SQL Server 2005!

We want to keep the server secure so don't want to enable sp_cmdshell

The code is being executed from a plain .asp page on a different webserver so BCP is out of the question

Do i have any other options?

My SQL query is simply SELECT * FROM myView. Occasionaly i will alter the structure of myView. If i need to use a SSIS package, is there a way to avoid having to re-jig the package everytime i alter myView? At the moment it gets rather upset and needs me to recreate the steps, remap all columns etc

Watch Question
This problem has been solved!
Unlock 6 Answers and 32 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE