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 3 years, 2 months ago by  Phil Parkin.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • 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