Executing a Stored Procedure that returns a result set in MS SQL Server

Added by Eduardo Bezerra 13 days ago

Hello,

I'm trying to execute a Stored Procedure in MS SQL Server, that returns a result set, but I can't figure what is the correct syntax.

I have the following Dbo class:

struct Auth {
std::string userName;
std::string password;

template<class Action>
void persist(Action& a) {
dbo::field(a, userName , "UserName");
dbo::field(a, password , "Password");
}
};

In the Database a have a simple Stored Procedure like:

create procedure sp_ViewAuth as
begin
select UserName, Password from [Authorization] D
end

The syntax I'm trying is;
collection< ptr<Auth> > recs = session.query< ptr<Auth> >("exec dbo.sp_ViewAuth");

But I got the error:
Error parsing SQL query: "exec dbo.sp_ViewAuth"

What would be the correct syntax to execute a Stored Procedure that returns a result set?

TIA,
Eduardo