April 16, 2010 at 4:05 am
Hi,
Within a Script Task (editor) I have a simple routine which is:
Public Sub Main()
Dts.Variables("fileName").Value = System.IO.Path.GetFileName(Dts.Variables("fileName").Value.ToString())
Dts.Variables("fullPath").Value = Dts.Variables("Location").Value.ToString() + Dts.Variables("fileName").Value.ToString()
Dts.TaskResult = Dts.Results.Success
End Sub
The procedure will loop through/retreive each xml file name it finds and populate the variable [User::fileName] with this value (i.e. xxxx.xml).
The package variables are all strings
When the above task is complete (I notice via debug/watch), the fullPath is populated as
'\\\\ServerName\\xml\\Samples\\xxxx.xml' - where the backslashes have been doubled-up
I have discovered that SSIS can treat blackslashes as escape characters. How do I get around this to produce
'\\ServerName\xml\Samples\xxxx.xml'?
Thanks,
April 16, 2010 at 4:49 am
Quick suggestion - I'm not sure it will work though - just a shot in the dark really.
Try defining the field value with a leading @ character - outside the quotes.
[User::Location] = @"\\ServerName\xml\samples\"
April 16, 2010 at 5:04 am
SSIS has to double-up the slashes, so I don't think you need to worry about it.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
April 16, 2010 at 5:43 am
To avoid any confusion the [User::Location] variable was originally defined as \\pisces\ABN_Pub\siantec\samples
- The single quotes surrounding this value were just to demonstrate the start and end of the field.
If I add a @ at the start to this field I get
Value@\\\\ServerName\\xml\\samples\\
April 16, 2010 at 5:47 am
Hi Wayne,
Thanks for your reply
Unfortunately, I do need to worry about it, as the value (with double backslashes) fails:
ERROR: [XML Source [1]] Error: The component "XML Source" (1) was unable to read the XML data.
However, if I type (or browse) \\ServerName\xml\samples\xxxx.xml it works
Thanks,
April 16, 2010 at 6:23 am
Hi,
I have resolved the issue. We had the 'Data access mode' set incorrectly.
It was set to 'xml data from variable' which we have now replaced to 'xml file from variable'.
An easy oversight.
Thanks to all who spent time contributing.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply