Using IF EXISTS with a stored procedure as argument

Viewed 7300

I have a stored procedure called 'authenticate' that returns me the user profile record if provided correct username and password. Now I am trying to get all users in system if 'authenticate' stored procedure returned me a record otherwise return nothing. I am trying something like this:

IF EXISTS EXECUTE authenticate @UserName, @Password
BEGIN    
    SELECT * from Users;
END

I am getting error: Incorrect syntax near the keyword 'EXECUTE'. Any ideas what am I doing wrong?

3 Answers
Related