I have a for each loop, that currently enumerates the table names for a database, and sets those table names into a variable. So, on the collection tab, the enumerator is set to 'Foreach SMO Enumerator'. Under the Enumerator Configuration, I have my connection manager, which allows me to browse to my database, select Tables, and specify to enumerate the table 'Names'. So far so good! Now, I want to pull my database name, from a package variable. So, the enumeration string currently is:
Database[@Name='mydatabase']/SMOEnumObj[@Name='Tables']/SMOEnumType[@Name='Names']
I want to replace the 'mydatabase' with the value of the variable @[User::SRCDATABASE]. Can I do this somehow, or do I need to use an expression to build this somehow? I tried using an expression for the EnumURN as follows:
"Database[@Name=' @[User::SRCDATABASE] ']/SMOEnumObj[@Name='Tables']/SMOEnumType[@Name='Names']"
Which evaluates fine, but when I close the settings, my foreach loop gives an error of "The enumeration type is not valid. Check the SMOEnumType in the Enumerate URN."
I then tried an expression for CollectionEnumerator as the same, but when I try to evaluate the expression I get an error "Cannot convert expression value to property type...Cannot convert 'System.String' to 'System.Boolean'.
Pretty sure I want an EnumURN, but having difficulty with the syntax to make that work with my variable.
Thanks in advance!
mpleaf
in case it helps, here's the screen shot of how it is set up, working, with me specifically putting in my db name.