Extract SQL table data into an excel spreadsheet

If you ever need to extract data from a SQL table into a spreadsheet. Here is a method to do it using BCP command line utility

bcp StackOverflow.dbo.Users out C:\Temp\UsersExtract.csv -SSQLSERVER01 -c -t"," -T

-S Servername switch (SQLSERVER01 is the servername)

out File path (csv file is created at C:\Temp folder)

StackOverflow is the database name

dbo.Users is the SQL table

Leave a comment