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 TrivediPosted Dec 12, 2013, 6:46 AM
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.
Maneesh A NPosted Dec 12, 2013, 6:40 AM
venkata kumarPosted Dec 12, 2013, 6:14 AM
try the fallowing
exec (@sqlquery)
end
Jignesh TrivediPosted Dec 12, 2013, 6:12 AM
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.