all groups > sql server dts > march 2007 >
You're in the

sql server dts

group:

Server.MapPath in SSIS script task?


Server.MapPath in SSIS script task? jobs
3/21/2007 12:48:44 PM
sql server dts:
Server.MapPath in SSIS script task?

I'd like to read a file (on the database server where ssis is running)
into a variable inside my ssis script task.

I have a reference to system.IO

but get name 'Server' is not declared during compile, so I removed it.


Dim FILENAME as String = Server.MapPath("readme.txt")

If I try the remaining code without the above line I get:

Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(Body)
Dim contents As String = objStreamReader.ReadToEnd()

error at runtime:

The given path's format is not supported.
Re: Server.MapPath in SSIS script task? Dan Guzman
3/22/2007 12:00:00 AM
[quoted text, click to view]

What are you trying to accomplish with MapPath? My understanding is that
MapPath converts the specified virtual path to a physical path within the
context of an IIS session. I don't see how this is useful with all on the
database server.

I don't know the details of your situation but configurable values such as
file paths and connection strings are usually provided to SSIS by assigning
variable values via config files or command-line arguments. Your script can
then use the SSIS variable to get the path at run time.

--
Hope this helps.

Dan Guzman
SQL Server MVP

[quoted text, click to view]
AddThis Social Bookmark Button