Currently, I am working on a project where we have more than 10 clients. We manage all clients through different schema. Every schema object is accessing only its own schema objects and not other schema objects.
Sometimes I need to update some stored procedures which are the same in all schema. In this case, I have manually opened and udpated the stored procedure for every schema. I googled for this, but didn't find anything. So, I created this script.
Here I am creating a testing scenario. In this, I create a table: "SchemaTable" in every schema (Marketing, Sales ,Accounts ,Economics, Employee, Manager, Employee). Then I create a stored procedure only in Employee schema. This schema is accessing only same schema table.
Now I want to create this store procedure in all schema, then execute the main script.
Note :- Before executing the script, please check the parameters and follow these steps:
1. Create an object for Testing. Execute "CREATE OBJECTS SCRIPT" from script section.
2. Change the pameter value:
@CopyFromSchema = Enter the schema name, where you want to pick the definition.
@CopyToSchema = Enter the schema name in which you want to create or update the object.
@ObjectName = Enter the object that you want to copy.
3. Drop object, Execute "DROP OBJECTS SCRIPT" from script section.
I feel that maybe someone is suffering like me, so I am sharing this.
Feel free to comment if you have any suggestions for this.