How to generate scripts to recreate table using SQL Server Management Studio [Schema and data]?

后端 未结 3 1394
猫巷女王i
猫巷女王i 2020-12-08 02:03

I have a table in a local SQL server database. I want to recreate this table in a hosted database.

What I want to do is to have a script that when run against the ho

3条回答
  •  生来不讨喜
    2020-12-08 03:02

    You can do this using Generate Scripts database task. Right-click the database > Tasks > Generate Scripts... Choose "Select specific database objects" and the table you want.

    On the Set Scripting Options page, click Advanced. There is an option "Types of data to script", choose "Schema and data". Choose where to save it. Next. Next. Finish.

    That is the answer however, if the table contains a large amount of data I recommend using bcp out or another method to export the data. If the new server is on the same network, you could also select it as a linked server.

    The script method will generate individual insert statements.

提交回复
热议问题