How to export SQL script files with data from SQLserver

I believe many people, when working on SQL Server database projects or downloading projects, usually use MDF files to attach the database or restore the database through a bak file in order to successfully run the project. However, sometimes they encounter the problem of not being able to import SQL Server with different versions, and the script usually does not contain data. So how do we export SQL script files with data? Let's take a practical operation below:

1. First, open our SQL server login tool, as shown in the following figure:

2. After opening, it is shown in the following figure:

3. Taking my [adsms] database as an example, right-click on the current data and select Task - "Generate Script"

Select Next
Select Table, Next
Select [Architecture and Data] in Advanced and then confirm
Select the path and click Next to export.