If you do your select as part of a datawindow or datastore you are returned the number of rows (along with the data). Otherwise an imbedded sql is either going to return a single row or, if multiple rows are needed, you need to declare a cursor and then fetch your data into it (and I assume you would increment a counter to tell how many rows were retrieved).