DB2/UDB batch query
Posted on 2001-07-30
I need to execute a batch DB2/UDB command under AIX which counts the number of records in a table. The resulting value will be used subsequently in the script.
A simple example under MS-SQL Server would be as follows from within a DOS batch file:
isql -S CMC_NT1 -d CSTI -U sa -P -Q "EXIT(select count(*) from Products)" > NUL
where ERRORLEVEL will contain the results of the SELECT statement.
I'm new to DB2/UDB and need to know how I can execute a query using the db2 command line utility and transfer the resulting value back to the operating system level (exit code?) for later use.