SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


cannot open datafile


cannot open datafile

Author
Message
l.caufriez
l.caufriez
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 86
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?
Brandie Tarvin
Brandie Tarvin
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14573 Visits: 8993
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 AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Phil Parkin
Phil Parkin
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18449 Visits: 20431
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search