How to generate SQL database script ?

Here we try to show  How to Generate a full SQL database script in new query editor window step by step. We use SQL Server 2017 here. We have a database named AjaxTestProject which have many Tables, Stored Procedure, Functions, View etc. We want to generate script this database with all schema  and data.  It's very simple let's have a look:

Step-1: Right click to database go to > Task > Generate Scrip
Figure-1

Step-2:
In new window checked Select specific database objects option and checked all you want. Click > Next
Figure-2
Step-3: Like figure-3 checked Save to new query window radio button than click to Advanced button from top right corner.
Figure-3
Step-4: In new sub window select Script create from multiple options (Script create, Script Drop, Script Drop and Create) like figure-4
Figure-4
Step-5: Like figure-5 select Schema and Data from multiple options. Click OK button.
Figure-5
Step-6: In this window we will see the summary and just click the Next button.
Figure-6
Step-7: Here the task processing, wait for complete. After complete click to Finish button.  
Figure-7
Step-8: Finally it's done. Our Generated Script is ready in new query editor. We can use it to save or executing.
Figure-8

1 comment:

Powered by Blogger.