![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I need to export data from sql table in txt file in same folder with name of the file which is constant in first part ( like 'test.'), and after test. every time diferent (It can be icremental number like test.1, test.2, test.3...). Is it possible Dubravko |
#3
| |||
| |||
|
|
Hello, Yes this is possible. You will need to use an Expression in the Connection String property of the flat file Connection Manager. Do this: * Click on the Flat File Connection Manager for the text file * In the Properties panel, look for Expressions. Click the elipsis (...) in the empty box next to it. * In the dialog box, select Connection String from the list, then click the elipsis again next to that. This will bring up the Expression Editor. * Enter a value for the file location using variables, string literals, and/or functions. For example: "\\\\MyServer\\MyShare\\MyFolder\\" + @[User::FileName] + ".txt" will incorporate the User variable FileName into the ConnectionString. Note that the backslash character \ is reserved so must be 'escaped' by putting the special escaping character in front of it, which just happens to be the backslash character. Hence the double \\. To put a Date Stamp in the file name, I typically use something like this: @[User::Logging_Folder] + @[System::MachineName] + "_" + @[System::PackageName] + "_Exec_" + (DT_STR, 8, 1252) ( YEAR(GETDATE()) * 10000 + MONTH( GETDATE() ) * 100 + DAY(GETDATE())) + ".txt" When you think you have it right, use the Evaluate Expression button so see what it would look like. Keep in mind that values can and will change from design time to run-time. HTH ===== Todd C "Spider Jerusalem" wrote: Hi, I need to export data from sql table in txt file in same folder with name of the file which is constant in first part ( like 'test.'), and after test. every time diferent (It can be icremental number like test.1, test.2, test.3...). Is it possible Dubravko |
![]() |
| Thread Tools | |
| Display Modes | |
| |