SQLTeam.com | Weblogs | Forums

ForEach Loop Connection Fails Due to Slash in Server Name


#1

Hi experts,
I'm trying to loop thru several server to collect info about those instances.
My ForEach Loop Container is failing due to the \ in the server\instance name. The values are read in from a table
which contains MyServer\Myinstance for example.

Error: The object name "MyServer\MyInstance" is not valid. The name cannot contain any of the following characters: / \ : [ ] . =

How can I get the connection to work for dynamic server names?
Thanks.


#2

Does

QuoteName(YourColumnName)

help at all?


#3

Thanks, Kristen. These are the errors the package gives in the ForEach Loop (as it attempts to loop thru a list of server names and set the Dynamic Connection. I'm missing something simple I think.

Error: 0xC001F202 at Foreach Loop Container: The object name "MyServer\MyInstance" is not valid. The name cannot contain any of the following characters: / \ : [ ] . =
Error: 0xC0017004 at Foreach Loop Container: The result of the expression "@[User::ServerName]" on property "\Package\Foreach Loop Container.Properties[Name]" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
Error: 0x3 at Foreach Loop Container: Variable "User::ServerCollection" does not contain a valid data object

Does anyone have any ideas? Thanks


#4

Kristen and others - I have re-posted this question in the SSIS forum. This TSQL forum is not the ideal one for my issue. Thanks