If you get the error "SQL query exceeds specified time limit or storage limit" you can either reduce the time it takes to execute the query or change the command timeout in seconds. Setting to 0 will remove the timeout, but is not recommended as it could cause a database query to hang indefinitely.
To change the command timeout, open your web.config and add the following key:
<!-- Setting this to a positive integer globally sets the number of seconds a database command is given to execute. Default = 30 (seconds) --> <add key="Dal.CommandTimeout" value="30"/>
If you don't want to change this global setting, you can also change the command timeout for individual queries by setting .ap_CommandTimeout on the input arguments.
NOTE: DB2 will try to calculate the time it will take to return a result and if that time is greater than the timeout, then it will fail without even trying.