ReadyRoll 1

Excluding Database Objects (Legacy method)

ReadyRoll Pro required

Please note that this feature is available exclusively to users of ReadyRoll Pro.


This method of filtering database objects has now been deprecated in favor of SQL Compare-compatible filter rules files. We highly recommend moving your exclude rules over to the new filter format as soon as practical. Once the filter file is configured, the <ExcludeObjectsFromImport/> property can then be removed from the project file (a build-time warning will be raised while the legacy property is still in use).

By default, ReadyRoll will import all objects from the connected database when you use the tool-window's Import and Generate Script command. Although you can selectively un-check objects that you do not wish to import, thereby excluding them from your deployment, it may be desirable to exclude certain objects from the import tool altogether (e.g. to prevent any changes from being accidentally re-selected for import).

It may be desirable to have ReadyRoll exclude entire schemas from the tool that may, for example, contain objects that are controlled by a third-party.

For these cases, ReadyRoll offers a project-level setting to allow you to control which objects are excluded from the script generation tool.

How to exclude objects from the script generation tool

In order to set the object exclusion rules, some knowledge of regular expressions is required, as these will need to be added to your database project's .sqlproj file.

Start by unloading the project in the Solution Explorer (right-click... Unload Project).

Then right-click the project again and edit the project.

Then insert the ExcludeObjectsFromImport property under the <Project> element, with regular expressions containing the names of the objects that you'd like to exclude. The following snippet includes a list of valid object types that can be excluded from being listed in the tool-window (remove any that don't apply):

sqlproj file snippet

<PropertyGroup>
  <ExcludeObjectsFromImport>
    Assembly=\[myschemaname\];
    Credential=\[mycredential\];
    DatabaseDdlTrigger=\[ddltriggername\];
    Default=\[dbautil\]\.\[(.*?)\];
    PartitionFunction=\[mypartitionfunction\];
    PartitionScheme=\[mypartitionfunction\];
    Role=\[myrole\];
    Rule=\[dbautil\]\.\[(.*?)\];
    Schema=\[dbautil\];
    Sequence=\[dbautil\]\.\[(.*?)\];
    StoredProcedure=\[dbautil\]\.\[(.*?)\];
    Synonym=\[dbautil\]\.\[(.*?)\];
    Table=\[dbautil\]\.\[(.*?)\];
    User=\[myusername\];
    UserDefinedDataType=\[dbautil\]\.\[(.*?)\];
    UserDefinedFunction=\[dbautil\]\.\[(.*?)\];
    View=\[dbautil\]\.\[(.*?)\];
    XmlSchemaCollection=\[dbautil\]\.\[(.*?)\];
    Contract=\[myservicebrokercontract\];
    EventNotification=\[myservicebrokereventnotification\];
    MessageType=\[myservicebrokermessagetype\];
    Queue=\[myservicebrokerqueue\];
    RemoteServiceBinding=\[myservicebrokerremotebinding\];
    Route=\[myservicebrokerroute\];
    Service=\[myservicebrokerservice\];
  </ExcludeObjectsFromImport>
</PropertyGroup>


Object types can be repeated within the property value, however there should only be a single ExcludeObjectsFromImport property within the database project file. For example, the following is a valid property value:

<PropertyGroup>
<ExcludeObjectsFromImport>
Table=\[dbautil\]\.\[(.*?)\];
Table=\[reports\]\.\[(.*?)\];
</ExcludeObjectsFromImport>
</PropertyGroup> 


Exclusion regexes can be configured to ignore certain objects.

For example, the following rule will exclude from import all Tables with names of the form '[dbo].[*]', except '[dbo].[Table1]' and '[dbo].[Table2]'

<ExcludeObjectsFromImport>
	Table=\[dbo\]\.\[((?:(?!\b(?:Table1|Table2)\b)[^\]])*)[\]];
</ExcludeObjectsFromImport>


Save the project file and re-load (right-click project in Solution Explorer and Reload Project).

Build the solution to clear the tool-window cache.

The next time you use the ReadyRoll tool-window to import changes from the connected database, the specified objects should be excluded from the generated script.



Didn't find what you were looking for?