Avatar of SURESH0518
SURESH0518
 asked on

What is the fastest to export output of a storedprocedure to a csv file using PowerShell

I have a SQL SERVER Stored procedure and it takes 4 minutes and output of this stored procedure is around 700k. WHat is fastest way to export to CSV using PowerShell. Any help is appreciated.
Microsoft SQL ServerPowershellSQL

Avatar of undefined
Last Comment
Zberteoc

8/22/2022 - Mon
Elliott Clark

There's not much detail in your question, therefore I'll assume you just want to know the PowerShell command to export to CSV

Export-Csv c:\temp

Open in new window


at the end of your script and change the location to wherever you wish to CSV file to be exported to
SOLUTION
aikimark

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Zberteoc

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Zberteoc

I think there have been enough answers already that deserve points rather than just deleting the question.
aikimark

I think the points should be split:
80% #a42359337
20% #a42359292
Your help has saved me hundreds of hours of internet surfing.
fblack61
Zberteoc

Somebody accepted the proposal for the points split as the correct answer! Probably who posted it.

:o)))))