SSIS_Get count of rows from source and load to destination - ssis

I have two OLEDB sources such as
DB Source1= select count(*) from A
DB Source2= select count(*) from B
Now, I need to get the count of Records uploaded
DB Source1 -DB Source2
for eg,
DBSource1 = 9 ;DBSource2= 1
then record uploaded will be 9-1=8
Finally I need them to be loaded to a flat file destination with following columns
RecordsReceived ErrorRecords RecordsUploaded
9 1 8
How do I achieve this?
TIA :)

You should look into the Row Count Transformation task. This one will count your selected records that flow through it and store it in a variable you declared. You can use those variables later in your script to store them in a flat file.

Related

LOOKUP No Match Output

I have 5000 rows in source file with 11 columns with no duplicate rows
& I loaded all those rows in the destination table.
Now I inserted one new record and I tried performing lookup
In the lookup I mapped all the 11 columns and did not pass anything
and o/p of lookup (No match output) is passed to the destination.
But my output has 5000(previously loaded) + 5001 = 10001 rows
But I require that 1 new record to be inserted into destination table
Why is this happening ? Can someone tell me where I am wrong
Alternate : I tried using SCD but I couldn't figure it out which can be my business key
Columns are : Purchased Date,City,Investor Name,Investor City, Developer Name,Square feet,Area Purchased...
The way this usually works is this:
[Load Source File/Table] => [Lookup based on destination]
On matches (either ignore or send to update)
On no match (Insert the record)

Skip rows when importing CSV to PowerPivot

I frequently need to pull some CSV reports and analyze them using powerpivot. The "issue" is that the tool spits out the report like this:
Report Name Keywords (Group contains 778600, Campaign contains us-en)
Client XYZ
Scope Entire Account
Date Range 3/12/2015
Filters Campaign contains us-en; Group contains 778600; Clicks > 0; Reduced Dimension
Keyword Account Publisher Campaign Group Search Bid $ Status Destination URL
Total for all 2 keywords
Keyword Account Publisher Campaign Group Search Bid $ Status Destination URL
bla bla bla Account Name Publisher Name Campaign Name Group Name 1 Active URL
So what i always need to do is to remove the first 9 rows of the CSV prior to importing. Usually i can do this on Notepad++, but sometimes the CSV is so large that i actually can't really open it to edit. So far i'm using a program called 010 Editor, but i have only some days left of it.
Is there an easy way to skip those rows when importing?
Thanks a lot
You can use Power Query (free to download) to load data to Power Pivot. It allows you to skip the first x rows and filter out rows with blank/null values. Once you are able to get this to work once, you can copy the M code to use it on other CSVs. Or you can automate it as a function and just feed it file locations.

nested loop with file1.csv and file2.csv in jmeter

I am using Apache JMeter and I need to run function call in 2 nested loops driven by csv datafiles. There is similar Q&A at How to implement nested loop in jmeter? but it's not based on datafiles.
I have 2 files:
long.csv:
1
2
3
...
100.000
and short.csv:
a
b
c
I need to run nested loop test with data from those files
foreach x from long.csv
foreach y from short.cvs
call(x,y)
and I want the calls look like this:
call(1,a)
call(1,b)
call(1,c)
call(2,a)
call(2,b)
call(2,c)
call(3,a)
call(3,b)
call(3,c)
...
call(100000,a)
call(100000,b)
call(100000,c)
The calls may be reordered, but I need unique call on every combination of inputs.
Suggestions?
If you are looking for detailed steps, please check here.
http://www.testautomationguru.com/jmeter-looping-2-csv-files/
I tried & it seems to work - Please check below snapshot for details.
CSV Data set Config 1 reads a csv file - the var ref name is 'vara'.
it has 10 rows , 1-10
CSV Data set Config 2 reads another csv file , contains 3 rows a, b c - and the var ref name is 'varb'. 'Allow ReCycle on EOF?' is set to True.
Thread Loop Count is for CSV Data set Config 1
Inner Loop Controller's loop count is for CSV Data set Config 2

How to get filename from file, look up that value in SQL table column, then return value from other column using SSIS?

Using SSIS (2008) and T-SQL: How can you get the filename from a file and look up that value in a SQL Table column and then return a value from another column?
I have a folder which has .jpg image files of products. All the filesnames are in the format eancode.jpg, for example 1234567891023.jpg. Each filename is unique: one eancode per image file for every product.
The productID (primary key, varchar) and the eancode (varchar) are stored in the same SQL table (without the .jpg extensions of course).
What I would like to do is rename the file from eancode.jpg to productID.jpg.
This is the process I had in mind, for example:
Files in FolderA:
ean1.jpg
ean2.jpg
ean3.jpg
Steps/Tasks:
get filename ean1 from ean1.jpg
look up ean1 in Table column EANcode
return corresponding productid: select productID from Table where EANcode = 'ean1'
store returned value from step 3 into package variable (?)
use stored value of step 4 to rename filename
do step 1 - 5 in a foreach loop for all images; If no match can be found it should do nothing with the files.
The main focus of my question is on step 2 - 4.
Thanks!
Your suggested solution would work perfectly. Set the result set (middle of the general tab) of the execute sql task to single value and then map the zero based result value to your package variable from within the result set tab

Pulling data from a text file to generate a report

Have a program in MS-Access, using VBA. I need to come up with an If statement to pull data from a text file. The data is a list of procedures and prices. I have to pull the prices from the text file to show in a report how much each procedure costs.
ID PID M1 M2 M3 Total
1 11120390(procedure)
2 180(price) 360 180 540 1080(total Price)
3 2 1 3 6(Units sold)
4
5 200(Price) 200 600 800 1600(total price)
6 1 3 4 8(Units Sold)
7 11120390(procedure)
The table in the text file is setup like this and I need to Pull the procedure number and the price of each procedure from the text file.
This is a general answer to a vaguely-presented question. You typically have to go through these steps:
Make a connection to the file
Open the file
Parse the file (as Simon was
saying): go through it as a series
of strings, find an orientation
point, get to the relevant parts
Import the relevant parts, perhaps
in a holding table
Present the data in typical Access
fashion (query, report)
And if the file isn't well structured or correctly generated, you'll need extra parsing code and perhaps error handling to deal with aberrations.