sql server - Calling stored procedure from another procedure with where clause -


i have table tblemployee sample data:

srno name      lastname ------------------------ 1    ibrahim   shaikh 2    ibrahim   mohammed 3    ibrahim   khan 4    paul      haymen 

and have stored procedure spgetemp. when execute procedure this:

spgetemp 'ibrahim','' 

it returning result data:

srno name      lastname ------------------------ 1    ibrahim   shaikh 2    ibrahim   mohammed 3    ibrahim   khan 

now want filter data stored procedure, want filter data last name, example 'shaikh'.

result should be:

srno name      lastname ----------------------- 1    ibrahim   shaikh 

what should do?

you'll need insert results temp table or variable, , execute select query desired where clause. example:

declare @results table(       srno int     , name nvarchar(30)     , lastname nvarchar(30) );  insert @results     exec spgetemp 'ibrahim','';  select srno, name, lastname  @results lastname = 'shaikh'; 

consider adding criteria spgetemp proc perform better if executed.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -