January 6, 2009 at 10:05 pm
I have to check the number of rows in an Excel. can it be done using an Execute SQL task?
January 7, 2009 at 2:38 am
Surely yes...
--Ramesh
January 8, 2009 at 5:30 am
Can you please tell how it can be done?
January 8, 2009 at 5:43 am
1. You have to create a variable "TotalRows" (i.e. name doesn't matter) of Integer data type and an Execute SQL Task.
2. Set the connection property, SQLSourceType as "Direct Input", SQLStatement as "SELECT COUNT(*) FROM SomeTable" and SQLResultset to "Single Row" of SQL Task
3. And in "Result Set" page, add a row with Result Name as "0" and select the variable "TotalRows" in variable name column.
Now you'll have the row count in the "TotalRows" variable...
--Ramesh
January 8, 2009 at 10:33 pm
For that i will have to load the rows in Excel into a table.
I was asking if you can get the count directly using the Excel?
January 9, 2009 at 12:09 am
ns.sharath (1/8/2009)
For that i will have to load the rows in Excel into a table.I was asking if you can get the count directly using the Excel?
No, you don't have to load any data. All you have to do is to make SQL Task to connect to the excel source. And in the source statement you have to write a query like
SELECT COUNT(*) FROM [SheetNameInExcelFile$]
--Ramesh
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply