As others have said, there are 3 "hidden" columns in every Aware table. ID, BASVERSION, BASTIMESTAMP. (ok, the ID is not really hidden). When you call a SP and want data returned, you have 2 choices:
1st, If you just need a couple of fields returned, they can be output statements in your SP, so your SP can look like
CREATE PROCEDURE test1
@x integer -- THIS IS AN INPUT PARAM
@y integer output -- THIS IS RETURNED TO AWARE
as
select @y = .... from .... where ... = @x
and your Aware SP call looks like EXEC_SP 'test1' WITH '@x' = BO.attr, '@y' = bo.attr2 OUT
OR, if you want to return a list, a table, you always need to return the 3 hidden fields for each row returned. the ID HAS to be unique. the other 2 can be 1 for BASVERSION and getdate() for BASTIMESTAMP or any other contstants.
Now, to solve the problem of the SELECT DISTINCT you could write your SQL SP to have an inner and outer select so it could look like
SELECT ROW_NUMBER() OVER (order by custname) as ID, 1 as BASVERSION, getdate() as BASTIMESTAMP, custname from
(select distinct custname from sometable) as X
The ROW_NUMBER() OVER (order by somefield) will give a sequential range of numbers. Many other ways to do that. you can also do a NEXT VALUE FOR BAS_IDGEN_SEQ as ID
Bruce