I am wondering if there is a standard way to parse a string like this:
Server[@Name='MyServerName']/Database[@Name='MyDatabaseName']/Table[@Name='MyTableName' and @Schema='MySchemaName']
The result should be:
- ItemName (Server)
- PropertyName (Name), PropertyValue (MyServerName)
- ItemName (Database)
- PropertyName (Name), PropertyValue (MyDatabaseName)
- ItemName (Table)
- PropertyName (Name), PropertyValue (MyTableName)
- PropertyName (Schema), PropertyValue (MySchemaName)
The most obvious here is to create a regular expression (and, of course, String.Split), but could there be a better, standard way?
For information: the string comes from SMO Urn.Value.
UPDATE
The answer is found, see below.
source
share