How to export tables and data from SQL Server 2017

Cenk 1,036 Reputation points
2022-12-13T08:25:13.083+00:00

Hi guys,

I need to export data and tables from SQL Server 2017 with Management Studio. I wonder if it is possible export from server and import into my local SQL express?

Thanks in advance.

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-12-13T22:51:02.167+00:00

    One option is to right-click the database in Object Explorer, and select Tasks->Generate scripts. When you come to the page where you select the target for the script, click the Advanced button which give you lots of options. Change Script Schema-Only to include data as well.

    Another way to copy a database is to use BACKUP/RESTORE, but this assumes that you can get hold of the backup file, which may not be simple if you have the database in a hosted environment.

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. PandaPan-MSFT 1,931 Reputation points
    2022-12-14T02:03:08.72+00:00

    Hi @Cenk
    I found the soulution in this link:https://stackoverflow.com/questions/11009189/export-table-data-from-one-sql-server-to-another
    I tested the soultion :right-click on Database -> select 'Tasks' -> select 'Generate Scripts'
    Select specific database objects you want to copy. Let's say one or more tables. Click Next
    Click Advanced and scroll down to 'Types of Data to script' and choose 'Schema and Data'. Click OK
    Choose where to save generated script and proceed by clicking Next
    And this works fine to me.
    270130-image.png

    1 person found this answer helpful.
    0 comments No comments

  2. Bjoern Peters 8,921 Reputation points
    2022-12-13T10:48:56.527+00:00

    Hi @Cenk

    sure, this is possible.

    In SQL Server Management Studio, connect to an instance of the SQL Server Database Engine.

    Expand Databases.

    Right-click a database.

    Point to Tasks.

    Click one of the following options.

    Import Data

    Export Data

    https://learn.microsoft.com/en-us/sql/integration-services/import-export-data/start-the-sql-server-import-and-export-wizard?view=sql-server-ver16#sql-server-management-studio-ssms

    If this answer was helpful, please click on "Accept answer", TiA


  3. Jingyang Li 5,896 Reputation points Volunteer Moderator
    2022-12-14T00:46:28.593+00:00

    You can create a DACPAC package to create a new database for your local machine.
    You can search for how to create a DACPAC package from SSMS and then import the package to create a new database with your database objects and data. (Export Data-tier application).

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.