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


Flat File connection Manager - File Name, The Folder in File Name changes every time the package is...


Flat File connection Manager - File Name, The Folder in File Name changes every time the package is reopoened and needs resetting

Author
Message
Debbie Edwards
Debbie Edwards
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2066 Visits: 696
Very strange issue.

I have SQL Tables and Im using a For Loop to split the table up via a variable and sent data to different CSV Files.

In the connection Manager its self I have juse added an example folder and file name

The data is split via a variable, and another variable creates the CSV Name in the Flat File connection Managers properties - Expressions - Connection String.

However when I save and close and then I go back in, within File Name, the folder has changed (Not the example file name given) just the folder. This means every time I open it up I have to go back in and reset the folder.

Its never the same folder either. If I run without doing this I cant figure out where the files are being sent too.

Has any one got any clues as to what I can do to sort this out.... or test?

Debbie
Daniel Bowlin
Daniel Bowlin
SSCertifiable
SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)

Group: General Forum Members
Points: 7902 Visits: 2629
Can you give a few examples of the folder names being generated? Also double check your file name expressions, maybe you have a missing \ or something. Is the folder supposed to be a fixed name? If it is driven from a variable with an expression that might be the issue.
Debbie Edwards
Debbie Edwards
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2066 Visits: 696
Its very strange. Its gone to about 3 different places. Almost like the last folder I was looking at when I was working on a different project.

I realised I needed to go to the flat file connection properties and expressions. For the connection String property it was set to just @[User:BigGrinFES_NAME_DATE_File_Name]+".csv"

So basically the file name with no folder attached.

I tried to change this to

"\\D-fs11\\spar-it\PROJECTS\\1 Active Projects\\DATA WAREHOUSING PROJECT\\Development\Extract_To_CSV\\"+@[User:BigGrinFES_NAME_DATE_File_Name]+".csv"

And was told that the token [Square bracket symbol] was not recognised. So I took that to mean the spaces in the folder names. I tried replacing them but nothing helped.

I then tried using another variable as the folder name so used the variable @Folder_Name which was already set with the actual folder name. This seemed to be good but when I ran it, the file names were created with [User:BigGrinFES_NAME_DATE_File_Name] twice but the first one was the same one every time and the second one was looped so this completely lost me.

So as yet I havent sorted it and worse Ive spent nearly all day trying to figure it out which is a massive waste of time on such a small thing. Crazy
kl25
kl25
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1148 Visits: 1875
These are tough problems to troubleshoot. For me, they've always been some small part of a variable or an expression. You've probably looked at the following but just in case... :-)

I tried to change this to

"\\D-fs11\\spar-it\PROJECTS\\1 Active Projects\\DATA WAREHOUSING PROJECT\\Development\Extract_To_CSV\\"+@[User:BigGrinFES_NAME_DATE_File_Name]+".csv"



Notice the single backslash. That would probably lead to the token not recognized message. [Edit note:] My attempts to highlight the backslash aren't working very well. It's between 'Development' and 'Extract_To_CSV'.



I then tried using another variable as the folder name so used the variable @Folder_Name which was already set with the actual folder name. This seemed to be good but when I ran it, the file names were created with [User:BigGrinFES_NAME_DATE_File_Name] twice but the first one was the same one every time and the second one was looped so this completely lost me.


I fought through a loop naming problem like this just recently. It turned out that I had added part of the expression for the name in two separate places, once in the variable expression for the file name and once in the actual final file name (including folder path) . So at each loop, each place was adding to the final name. Don't know if that's what happened here but it sounds similar.
Debbie Edwards
Debbie Edwards
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2066 Visits: 696
Heres a thought.....

In the Flat file connection managers properties I have

ConnectionString set to \\D-fs07\spar-it\PROJECTS\1 Active Projects\DATA WAREHOUSING PROJECT\Development\Extract_To_CSV\Test.csv

And Expressions Connection String set to @[Extract_To_CSV_Folder]+@[User:BigGrinFES_NAME_DATE_File_Name]+".csv"

The fact there are 2 connection strings is very confusing. Could this be why its going wrong?
Debbie Edwards
Debbie Edwards
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2066 Visits: 696
Doze your right! I think Im going to have to reask for a bigger screen, I dont think my eye sight is doing me any favours. Ill have another go at that one
kl25
kl25
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1148 Visits: 1875
Debbie Edwards (2/21/2013)
Heres a thought.....

In the Flat file connection managers properties I have

ConnectionString set to \\D-fs07\spar-it\PROJECTS\1 Active Projects\DATA WAREHOUSING PROJECT\Development\Extract_To_CSV\Test.csv

And Expressions Connection String set to @[Extract_To_CSV_Folder]+@[User:BigGrinFES_NAME_DATE_File_Name]+".csv"

The fact there are 2 connection strings is very confusing. Could this be why its going wrong?


Probably not the issue here. The expression would replace the hard coded connection manager when the process runs.
Debbie Edwards
Debbie Edwards
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2066 Visits: 696
Debbie Edwards (2/21/2013)
Doze your right! I think Im going to have to reask for a bigger screen, I dont think my eye sight is doing me any favours. Ill have another go at that one


Nope Id already sorted that one out the last time I had ago and Im still getting the same error about the [Square symbol] not being recognised.

And adding the folder as a variable is doing even crazier things.

And I dont understand Why I have in properties ConnectionString and Expressions - ConnectionString.
Debbie Edwards
Debbie Edwards
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2066 Visits: 696
kl25 (2/21/2013)
Debbie Edwards (2/21/2013)
Heres a thought.....

In the Flat file connection managers properties I have

ConnectionString set to \\D-fs07\spar-it\PROJECTS\1 Active Projects\DATA WAREHOUSING PROJECT\Development\Extract_To_CSV\Test.csv

And Expressions Connection String set to @[Extract_To_CSV_Folder]+@[User:BigGrinFES_NAME_DATE_File_Name]+".csv"

The fact there are 2 connection strings is very confusing. Could this be why its going wrong?


Probably not the issue here. The expression would replace the hard coded connection manager when the process runs.


Ah, so its definitely using the ConnectionString one. Im totally lost now as to how Im going to get the folder name in there, Unless I change all my folders to be in the C drive, without spaces in the Names, but I feel like that would be the wrong way to go, you should be able to have your folders any where, not just the C Drive
kl25
kl25
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1148 Visits: 1875
Here's the general approach I use:

1. Set a variable for the path (folder). Learned early on to separate the path because paths that I thought would NEVER change did. :-P
2. Set a variable for the file name. This is often an expression to allow including the run date or other important but changing aspects of the file name.
3. Set a variable for the full file name. This is always an expression of @Path + @FileName.
4. Set the expression for the connection string to @FileNameFull for the flat file connection manager via the properties window, expressions section.

I think that's what you're doing but I'm not positive.
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