Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

cannot open datafile Expand / Collapse
Author
Message
Posted Thursday, December 20, 2012 5:44 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 17, 2014 8:35 AM
Points: 27, Visits: 67
Hi,

i'm creating a ssis package to access a flat file.

i created a batch script to obtain the filename of the newest file in a folder.
this work fine, but when i want to give that filename to the connection manager by expression (i addes the UNC path with the variable who contains the filename)

at runtime i have the error : cannot open datafile...

who can help me?

Post #1398927
Posted Thursday, December 27, 2012 4:36 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 9:11 AM
Points: 7,128, Visits: 6,291
Do you know how to use Script Tasks? I use them to check the values of my variables after the variables have been set.

Here are instructions in case you don't know how to use it.

Add Script Task right after the step that loads the variable value. (This is important as adding it before the variable is loaded will not give you the answer you need).

Choose Visual Basic as the script language in Script tab. (If you don't do this first, it will default to C# and you won't be able to change it short of deleting and recreating the task). C# is fine, BTW, if you know how to program it. This example uses a Visual Basic command.

In ReadOnlyVariables, put the variable names you want to check.

Click Edit Script.

Under Public Sub Main(), put the following code (do not put a single quote before it!):

MsgBox("This is the value of my variable named XYZ " + Dts.Variables("XYZ").Value.ToString)


XYZ, is the name of the variable you are reading. You can output multiple variables to a single message box command, but I prefer to do them one at a time so I can see them all.

When you run the package and it reaches this step, a little popup box will appear with your sentence and the value of the variable. If the sentence ends at "named XYZ" and nothing is after it, or if the popup message is blank, you've somehow got a NULL in your variable.

The package will stop until you click OK on this message box. Once you click OK, then it will continue on.

Usually you'll see an error in the path name at this point, or indications that the variable is not being loaded correctly. This is an essential troubleshooting tool for variables (though there may be others) that will help you nail down the problem.


Brandie Tarvin, MCITP Database Administrator

Webpage: http://www.BrandieTarvin.net
LiveJournal Blog: http://brandietarvin.livejournal.com/
On LinkedIn!, Google+, and Twitter.

Freelance Writer: Shadowrun
Latchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Post #1400558
Posted Friday, December 28, 2012 2:09 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 7:59 AM
Points: 4,976, Visits: 11,666
This is an essential troubleshooting tool for variables (though there may be others) that will help you nail down the problem.


There are others - simply setting a pre-execute breakpoint on the task immediately following the one which sets the value of a variable will allow you to see the values of all variables' run-time values at that particular point.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1400832
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse