alter procedure prcEmpView
(
@Wherecondition nvarchar(4000)
)
as
begin
declare @sqlquery nvarchar(4000)
set @sqlquery=
'select
vEmpName,
vAddress,
vPhone,
vEmail
from tblEmployee
'+@Wherecondition
execute sp_execute @sqlquery
end
pls correct as soon as possible

Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 12, 2013, 1:12 AM EST
is your where condition correct?
also you can use Exec(@sqlquery) at the end of SP to execute you dynamic query....
are you got any error? pls share more information.
venkata kumarRank #5,034 · 314 reputationPosted Dec 12, 2013, 1:14 AM EST
try the fallowing
exec (@sqlquery)
end
Maneesh A N179 reputationPosted Dec 12, 2013, 1:40 AM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 12, 2013, 1:46 AM EST
hi,
are you adding any other content to sql condition before sending it to stored procedure?
i guess your stored procedure is similar to original post.