Sandy Westman
asked on
Syntax for WQL Source Query in SSIS Variable
I've got an SSIS package that watches for XML files in a specific folder. The package works when I enter the WQL Query directly into the task editor, but I can't get it to work using the same query as a variable. This must be a syntax issue but I haven't been able to find any examples of creating this kind of query in a variable. The query I'm typing in directly is:
Select * From __InstanceCreationEvent Within 10 Where TargetInstance ISA 'Cim_DataFile' And TargetInstance.Drive = 'C:' And TargetInstance.Path = '\\Data\\' And TargetInstance.Extension = 'xml'
When I tried to set this same query as the expression of a variable and evaluated the expression, I got an error like "...unrecognized token: select". So then i enclosed the whole string in double quotes. It evaluated okay, but when I ran the package in Design mode I got the error "unparseable query."
The scope of the variable is the package. I have 'evaluate as expression' set to True. The data type of the variable is String. If i enter the query without the quotes into the WMI Tester it succeeds and if I enter the query with the quotes i get the same error = unparseable query.
My ultimate goal is to replace the 'C:' and the '\\Data\\' with variables that are set per configuration. I tried that first and now I'm stepping back to get any query to work as a variable.
Can someone help me understand how this WQL query needs to look when the WQL Source Query Type is Variable?
Select * From __InstanceCreationEvent Within 10 Where TargetInstance ISA 'Cim_DataFile' And TargetInstance.Drive = 'C:' And TargetInstance.Path = '\\Data\\' And TargetInstance.Extension = 'xml'
When I tried to set this same query as the expression of a variable and evaluated the expression, I got an error like "...unrecognized token: select". So then i enclosed the whole string in double quotes. It evaluated okay, but when I ran the package in Design mode I got the error "unparseable query."
The scope of the variable is the package. I have 'evaluate as expression' set to True. The data type of the variable is String. If i enter the query without the quotes into the WMI Tester it succeeds and if I enter the query with the quotes i get the same error = unparseable query.
My ultimate goal is to replace the 'C:' and the '\\Data\\' with variables that are set per configuration. I tried that first and now I'm stepping back to get any query to work as a variable.
Can someone help me understand how this WQL query needs to look when the WQL Source Query Type is Variable?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER