TSM client queries need equivalent of TOP 100 or FETCH FIRST 100 ROWS ONLY

dnw

Newcomer
Joined
Nov 14, 2017
Messages
2
Reaction score
0
Points
0
We are using dsmadmc.exe client to run "SELECT ..." queries, but find that we need to limit the number of rows returned.
I have tried SQL Server style (TOP 100) & DB2 style (FETCH FIRST 100 ROWS ONLY), but these do not work (give SQL error).
Please give example of how it can be done in dsmadmc situation. Or link to applicable docs.

My first post, so apologies if this issue is covered elsewhere. Thanks
 
The error might not be due to your fetch, you have the right syntax for the fetch part of it, so your syntax error is likely before the text. The SQL error can give you an indication of what's wrong.
Code:
select * from summary order by start_time asc fetch first 100 rows only
Code:
select * from summary order by start_time desc fetch first 100 rows only

To run with dsmadmc, just put the query between quotes:
dsmadmc -id=admin -pa=password "select ..."

It will be faster and easier if you get the query to run first while already in the admin command line, once you got the query to work, feed it to dsmadmc.
 
The error might not be due to your fetch, you have the right syntax for the fetch part of it, so your syntax error is likely before the text. The SQL error can give you an indication of what's wrong.
Code:
select * from summary order by start_time asc fetch first 100 rows only
Code:
select * from summary order by start_time desc fetch first 100 rows only

To run with dsmadmc, just put the query between quotes:
dsmadmc -id=admin -pa=password "select ..."

It will be faster and easier if you get the query to run first while already in the admin command line, once you got the query to work, feed it to dsmadmc.
Thanks for quick response.
Our only problem was that the initial tests were done on TSM servers with version 5.x, where FETCH... is not supported. However, on TSM servers with version 6+, it works well. You post gave me the reason to test more fully. Thanks again
 
Back
Top