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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: