SSIS-Variable File Name - ssis

I have a folder in which every month I will put a single excel file with name (depending on the month) like 'Jun file', 'Jul file', 'Aug file' and others. I want to move this file from folder to Sql database and form the table of the same name, that is 'Jun file'(if it is the June Month's file).
I am trying to do it through SSIS by forming the variable but I am unable to do it. How should I create the variable for this varying file name.

Related

How to merge multiple .HDF5 files in single file in Octave

I have multiple .HDF5 files of 30 min IMERG precipitation data for a month (July 2022) in a folder having same shape.
Is there a way to merge multiple files in a single file through Octave or any other source?
If not the how to open multiple files at once and access the data within the files.
I have tried this but getting an error
data = data_from_multiple_HDF5_files('F:\Task_3_IMERG\HDF5_Practice', '*.HDF5' )
error: 'data_from_multiple_HDF5_files' undefined near line 1, column 1

How do I create a csv file in SSRS with a .txt extension in the file name?

I have a report where I have added a data driven subscription that writes the report to a folder location on a daily schedule. The report is rendered as csv. the file name comes as MyReport1234.csv.
I need this to be Myreport1234.txt. How can I do this in SSRS?
I use SSRS 2008 R2 btw
found a solution for this:
Create a data driven subcscription
on Step 3, just write SELECT 1 or if you're trying to generate a dynamic file you could embed the logic for this in your select statement and give it an alias like SELECT 'Myreport1234.txt' as [FileName]
on Step 4, either Specify a static file name, or get the value from the database using the column "FileName" which you created in the previous step.
set the Render Format to CSV
This is the important step >> File Extension must be set to False. This will stop the renderer from adding the default extension for the renderer of your choice. leaving whatever thats on the filename to appear as the file extension.

Delete the last row of excel file using SSIS

I have an SSIS package that creates and populates an excel sheet, it creates the sheet from a template file.
I want to check the Excel file by "startdate",if a new product to be added, must this new product be deleted. and then send a warning e-mail
thanks
Is "Start Date" held on a database somewhere? If so you could read this value using an "Execute SQL task" or "Lookup" and store the value as a variable.
A "Conditional split" could then compare the date with that coming from the flat file. If the Start Date in the file is later than your stored value then output this data to a flat file/alternate database.
In a separate data flow task check for records in the flat file/alternate database.
If there are records then send an email with the flat file data as an attachment.

moving data of multiple excel files into multiple database tables using ssis

i have a scenario to create SSIS package Load different excel files in a folder to different SQL table with file name as table name, can any one help me
Thanks
If All Sheets have same columns ,
a)Get List of Execelfile paths and destination server and table name into object variable
b) Get object record through foreach loop
c) Give Excel filepath variable in input expression and server ,table info at destination expression
each file will be loaded to corresponding table

how to load extracted file name into sql server table in SSIS

i have 3 csv files in a folder which contains eid, ename, country fields, and my 5 csv files names are test1_20120116_034512, test1_20120116_035512,test1_20120116_035812 etc.. my requirement is I want to take lastest file based on timne stamp and modified date, which i have done. Now i want to import the extracted file name into destination table..
my destination tables contains fields like,
filepath, filename, eid, ename, country
I have posted regarding this before in the same site i got an answer for extracting filename, now i want to load the extracted FileName into destination table
Import most recent csv file to sql server in ssis
my destination tables should have output as
C:/source test1_20120116_035812 1234 tester USA
In your DataFlow task, add a Derived Column Transformation. The value of CurrentFile will be the fully qualified path to the file. As you only want the file name, I would look to use a replace function on that with the base folder and then strip the remaining slash. This does not strip the file extension but you can add yet another call to REPLACE and substitute an empty string
Derived Column Name: filename
Derived Column:
Expression: REPLACE(REPLACE(#[User::CurrentFile], #[User::RootFolder], ""), "\\", "")
The above expects it to look like
CurrentFile = "C:\source\test1_20120116_035812.csv"
RootFolder = "C:\source"
Edit
I believe you've done something in your approach that I did not do. You should see a warning about possible truncation but given the values discussed in this and the preceding question, I don't believe the 4k limit on expressions will be of concern.
Displaying the derived column
Demonstrating the derived column does work
I will give you a +1 for providing an approach I wasn't aware of, but you'll still need to add a derived column to match your provided format (base path name)
Full path is provided from the custom properties. Use the above REPLACE section to remove the path info except use the column [FileName] instead of #[User::CurrentFile]
I tried to get the filename through the procedure which Billinkc has given, but its throwing me error stating that filename column failed becaue of truncation error..
Any how i tried different approach to load file name into table.
steps i have used
1. right click on flat file Source and click on show advanced edito for Flat file
2. select component Properties tab
3. Inside that Custom Properties section ---> it has a property FileNameColumnName
I have assigned Filename to that column property like
FileNameColumnName----> FileName thats it, am able to get the filename into my destination table..