How do I get a count of database records?
How do I get a count of database records?
- Add an SQL task and select the database resource you want to use.
- Add a query element, and specify the following SQL statement. For example:
select count(*) from libraryName.fileName - Specify a variable name in the Output Variable field (e.g. "data")
- Then add a Set Variable task, found in the Miscellaneous folder.
- Enter a variable name (call it "count" for now) and then using variable notation, specify column one of the rowset defined in the Output Variable above. (e.g. ${data[1]})
The snippet below shows what the project would look like:
- Code: Select all
<sql resourceId="resourceName">
<query outputVariable="data">
<statement>select count(*) from table</statement>
</query>
</sql>
<setVariable name="count" value="${data[1]}" />
- Support_Duane
- Support Specialist
- Posts: 66
- Joined: Thu Mar 05, 2009 2:49 pm
Who is online
Users browsing this forum: No registered users and 1 guest