Generating .sql file of your database with data
SQL Server Management Studio provides the ability to generate scripts for creating databases, tables, stored procedures, functions, views and inserting data. For smaller amounts of data, this method can be used to send table structures and/or data to Scribe Support for testing purposes.
To proceed, Open SSMS and access the database engine with the default Windows authentication (or from the connection that you want to access):
Connect to the server and explore the databases in the object explorer. In our case, we want to export the my_database
database, that, as you can see, is available in the Databases directory:
Do right click on the database and select Tasks and then on Generate Scripts:
This will open the Generate and Publish Scrips dialog. As first step, define which tables of the database you want to export, optionally you can script the entire database and objects:
After confirm which tables do you want to export, proceed to define if you want a single file per table or everything in a single file. If you go to the advanced scripting options, you can define the types of data to script, this means if you want to include the data on the file directly or only the structure of the database:
Finally, the export will begin and you will see the success message at the end:
https://ourcodeworld.com/articles/read/846/how-to-export-a-ms-sql-server-database-to-a-sql-script-database-to-sql-file-with-microsoft-sql-server-management-studio-17