Copiar table con objetos (SQL) con scripts

Javier Santillan 21 Reputation points
2022-10-13T12:05:58.16+00:00

Good! How are they?

I need to copy several tables from one base to another (without the data but with the objects in the table)
I cannot use the Scripts Table to generate the scripts automatically and I proceeded to copy the tables with SELECT * INTO, but I would be missing the objects in the table such as indexes and triggers.
I am using SQL 2008 R2.
Any ideas?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,363 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,263 questions
{count} votes

Accepted answer
  1. CathyJi-MSFT 21,136 Reputation points Microsoft Vendor
    2022-10-14T03:37:58.84+00:00

    Hi @Javier Santillan ,

    Agree with Olaf, suggest you using generate scripts wizard as below screenshots. In addition, suggest you use a newer version SSMS. You can get SSMS 18.12.1 from here.

    250301-capture.png
    250230-capture1.png
    250234-capture2.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 43,246 Reputation points
    2022-10-13T12:33:00.46+00:00

    I am using SQL 2008 R2.

    That version is out-of-support since a long time.

    Anyway, in SSMS do a right-mouse click on the database => Tasks => Generate scripts ...
    In the wizard you can select which object (type) you like to script out.
    See Generate Scripts (SQL Server Management Studio)