How to use Where Clause in Exec Stored Procedure
<p>I'm having a Stored Procedure </p>

<p>Table Structure:</p>

<pre><code>CREATE TABLE employee(
    id          INTEGER NOT NULL PRIMARY KEY,
    first_name  VARCHAR(10),
    last_name   VARCHAR(10),
    salary      DECIMAL(10,2),
    city        VARCHAR(20),   
)
</code></pre>

<p>Adding Some Data to the employee Table:</p>

<pre><code>INSERT INTO employee VALUES (1, 'Karvendhan',  'Palani',4789,'Agra');
GO

INSERT INTO employee VALUES (2, 'Bala',  'Manigandan',8789,'Bombay');
GO

INSERT INTO employee VALUES (3, 'Raj' ,  'Kishore',   5567,'London');
GO

INSERT INTO employee VALUES (4, 'Prayag',  'Pavithran',  4467,'Bombay');
GO

INSERT INTO employee VALUES (5, 'Selva',  'Kumar',  3456, 'Bombay');
GO

select * from employee;
</code></pre>

<p>My Stored Procedure:</p>

<pre><code>CREATE PROCEDURE GetEmployeeBasedOnCity
(
    @city VARCHAR(20)
)

AS
BEGIN
    select * from employee where city = @city
END;
</code></pre>

<p>I'm Executing the Stored Procedure: <code>exec GetEmployeeBasedOnCity 'Bombay';</code></p>

<p>I'm getting the Output:</p>

<pre><code>id      first_name       last_name        salary          city
-----------------------------------------------------------------
2       Bala             Manigandan       8789.00        Bombay
4       Prayag           Pavithran        4467.00        Bombay
5       Selva            Kumar            3456.00        Bombay
</code></pre>

<p>I need to put where clause at the time of <code>exec GetEmployeeBasedOnCity 'Bombay';</code>
not inside the Stored Procedure. Kindly assist me...</p>

<blockquote>
  <p>Imagine the Query (Rough Expectation)</p>
  
  <p><code>exec GetEmployeeBasedOnCity 'Bombay' WHERE salary &gt;5000</code></p>
</blockquote>