Script to Compare schema two different databases two different servers

  • I have looked online and on this forum but couldn't find exactly what i am looking for. I need a script that will dump definition of all the objects include table,sp,functions,views in a temp table. Then i will use the same script to get a dumo from other database and join them. Does anyone have such script?

    I am very well aware of Red Gate and other tools. I need this to be automated ,hence i need the scripts.

  • curious_sqldba (7/28/2016)


    I have looked online and on this forum but couldn't find exactly what i am looking for. I need a script that will dump definition of all the objects include table,sp,functions,views in a temp table. Then i will use the same script to get a dumo from other database and join them. Does anyone have such script?

    I am very well aware of Red Gate and other tools. I need this to be automated ,hence i need the scripts.

    I don't understand what you are looking for here. Are you wanting to get the ddl for every single object in the database? Do you have a specific structure for your table in mind? You mention joining this with similar data from another database. How do you plan on joining these tables? As it sits right now your question is sufficiently vague enough that it is incredibly difficult to even begin an answer. You need to provide us a LOT more information here.

    FWIW, this type of script is not going to be easy to put together. This is exactly why tools like SQL Compare exist.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (7/28/2016)


    curious_sqldba (7/28/2016)


    I have looked online and on this forum but couldn't find exactly what i am looking for. I need a script that will dump definition of all the objects include table,sp,functions,views in a temp table. Then i will use the same script to get a dumo from other database and join them. Does anyone have such script?

    I am very well aware of Red Gate and other tools. I need this to be automated ,hence i need the scripts.

    I don't understand what you are looking for here. Are you wanting to get the ddl for every single object in the database? Do you have a specific structure for your table in mind? You mention joining this with similar data from another database. How do you plan on joining these tables? As it sits right now your question is sufficiently vague enough that it is incredibly difficult to even begin an answer. You need to provide us a LOT more information here.

    FWIW, this type of script is not going to be easy to put together. This is exactly why tools like SQL Compare exist.

    Actually i just came to know you could use SQL Compare's API through command line ( available only in Professional Edition) , i tried it out and works great :).

    I basically have two databases on two different servers. Schema should always be same on these two databases, i need to get notified when it is out of sync. For sprocs it is pretty straight forward to find out but for tables i didn't have find a good solution using script.

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

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