I have created this blog to learn more and more about SSIS and Sql server.
Here you will find posts about Control Flow Task, Data flow transformation and lot more. I have tried to explain transformations and tasks through simple scenario and example.
I hope this would help you
Monday, May 13, 2013
Sql Server: Delete all the objects from the database which are created by user, and not in template database.
Delete all the objects from the
database which are created by user, and not in template database.
of scenario exists generally in dev environment. When we have one template database
and our db in dev environment should contain only objects which are present in
template database. But every day, some db developer works on original database
and creates some objects, which he forgets to delete. In such case every day,
this operation will be performed and objects created by the developer for their
experiment will be deleted.
below script AdventureWorks2008 is my template database and sampleadventure is
database in dev environment. So sampleadventure should only contain objects
present in AdventureWorks2008 database.
used cursor for this. Collate is optional, try without collate. I have used
collate because the collation was different for both database.