hi and welcome in this video you will
learn how to export
table records of a sql server database
to excel sheet in our previous video
i have given a demo on how to import
data from excel to sql server
if you haven't watched this video yet i
will leave a link in the description you
can watch it from there
and if you have visited my channel for
the first time and not subscribed my
channel please do subscribe my channel
for more videos and hit the bell icon to
get notified of the upcoming videos
let us proceed with a demo
here is my sql server instance
i have
sample databases here let me take one of
the database as an example
so i am taking mydb as an example in
this database i have total four tables
so i want to export
table data to my excel sheet
first let me see what are the contents
present inside this table
i have total 20 rows
20 records i have in this
customer table so i want to export
these table results to the excel sheet
let's see how
right click on your database
we have tasks
and then export data
once you click on export data you will
get
your sql server import and export wizard
click next to proceed
here
select the data source
my data source is microsoft sql server
native client 11.0
here my server name is auto populated if
it is not populate auto populated you
can enter the name or you can select
from the drop down list
and i'm going with the windows
authentication and select your database
i am going with mydb database
and click next
here select your destination
my destination is microsoft excel
and browse the excel path i have already
saved one excel sheet here this is a new
excel sheet i have created
this excel sheet is empty you can see
it contain no data
so once i export data to this excel
sheet i'll get another tab here
let me show you
so here browse your excel path
this is my excel sheet
open
you can also create an excel sheet new
excel sheet from here just right click
on this window and click new and you can
create your
excel sheet from here
okay and click next select the version
and proceed next
here you have two options
copy data from one or more tables or
write a specific query for the data
transfer
select this first option if you want to
export all the records from the existing
table
or if you want to write a specific sql
query
let us say you want to export top 100
rows
or you have some t sql script where you
use inner joins and all so in that case
you need to select this option and then
you have to write your t sql statement
here
only those qualified rows will be
exported to the excel sheet
okay
so for now i'm going with the first
option itself i am going to export all
the table records
click next
and select the table i want to export
customer table
in the destination if you want to change
the table name you can change
customer underscore
exported
okay
you can edit mappings or you can preview
the results here
so this is how it will look in your
excel sheet okay
so i'm okay with this preview
going next
and click next
yes i want to run immediately click next
and finish
the execution was successful now let's
check the excel sheet
here is my excel sheet
let me open
so you can see this is sheet1 this is my
exported table records
i have all my 20 records here
that has been exported from my sql
server database
so this is how we do it
i hope you have enjoyed this video
in our next video we will see how to
export these records using a batch file
that is going to be so interesting
because anyone who has
no knowledge on sql server can also
export the results
with just a click
let's meet in our next video
that's all in this video
thanks for watching the video please do
like share and subscribe for more videos