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.
Go into Tools -> Options -> Designers-> Uncheck "Prevent saving changes that require table re-creation". Voila. That happens because sometimes it is necessary to drop and recreate a table in order to change something.
Right click on the DB_NAME -> Select Task -> Select Generate Script. Follow along the presented wizard and select all tables in that database to generate the scripts.
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".
6- Save your script and smile :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With