• 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.