How to get the 16 tables that are not in TEST but are there in PROD?

  • I have a database D1 in Prod and TEST. In Prod D1 has 266 tables and in TEST D1 has 250 tables. How to get the 16 tables that are not in TEST but are there in PROD?

  • To get the tables in a database, use sys.Tables:

    SELECT Schma = SCHEMA_NAME(t.schema_id), TabName = t.name
    FROM sys.tables t;

    I'm sure that you can work out the rest by yourself.

    • This reply was modified 2 years, 6 months ago by  Phil Parkin.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Or, look at a tool like Redgate SQL Compare. That lived open, and in active use, all day, every day, on my machine until I was hired by the company that builds it.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply