Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

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

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 hosted database, this table is recreated with all the data, etc.

How do I create this script using SQL Server Management Studio? Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

1- Open SQL server Management Studio.

2- Right click on the DB that contains your desired table.

3- Select "Tasks => Generate Scripts...".

4- Follow on the wizard, and choose the objects that you want to generate scripts for (Tables, Views, Stored Procedures, etc... ).

5- From the next step, click on "Advanced", and for the node that is labeled "Types of data to script" choose "Schema and data".

enter image description here

6- Save your script and smile :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...