There is a SQL Server database. What means it is possible to translate it into SQL (or T-SQL) script so that he himself creates all the tables and so on?

    4 answers 4

    Good day.

    Your task is solved in any elementary version of SSMS (SQL Server Management Studio):

    1. Right-click on the name of the database (not the table) and select in the tasks Generation script
    2. Next, select the necessary tables.
    3. Click advanced settings and put a check mark next to the scheme and date (if you need data in addition to the structure)

    In fact, for this whole operation, PowerShell is used, so if such a task is for a group of servers and you want to optimize it, then you can start here and see here

      The SQL Server Database Publishing Wizard provides a way to publish a database into a single T-SQL script that can be used to recreate a database (both schema and data).

        In the case of MySQL + phpMyAdmin, do the last export and enjoy life =) In your question, after all, it means the SQL server from Microsoft? For him, similar built-in tools for creating backups of this type are unknown to me.

        • one
          Who needs to know that you do not know something? The question is not implied, but explicitly stated that this is MS SQL Server. - Anatol

        use the mysqldump utility

        mysqldump -uLOGIN -PPORT -hHOST -pPASS DBNAME > dump.sql 
        • you confuse mssql with mysql - nick_n_a