Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Exec Command on a stored procedure

Author  Topic 

poilafrir
Starting Member

2 Posts

Posted - 2000-10-19 : 04:28:54
Hi
i'am building a stored procedure . the query is writtent in a varchar variable , and then i lauch it with Exec . I want the recordet generated by the SQL SElect instruction in my ASP page .... but the query doest return anything

thxs ( sorry for my poor english , it's too early in the morning to think)

---here is the code ( don't care about french names)
CREATE PROCEDURE proc_emploi_recherche_offre(
@cledomaine varchar,
@cletypeposte varchar,
@clecontrat varchar,
@cledepartement varchar,
@mot1 varchar(50),
@mot2 varchar(50)
)
AS

declare @ordre varchar(1000)


set @ordre = 'SELECT Clé_Offre, Ref_Offre, Intitulé_offre, Description_du_poste
FROM Emploi_Offre WHERE (
(( Intitulé_offre Like ''%'+ @mot1 + '%'')
Or (Intitulé_offre Like ''%'+@mot2+ '%'')
Or (Formation_complémentaire Like ''%'+@mot1+ '%'')
Or (Formation_complémentaire Like ''%'+@mot2+ '%'')
Or (Description_du_poste Like ''%'+@mot1+ '%'')
Or (Description_du_poste Like ''%'+@mot2+ '%''))
AND (Clé_Domaine = 19 or Clé_Domaine = '+ convert(char,@cledomaine)+') '

if @clecontrat is not null
begin
set @ordre = @ordre + ' AND ( Clé_Type__contrat='+ convert(char,@clecontrat)+')'

end

if @cledepartement is not null
begin
set @ordre = @ordre + ' AND ( Clé_Type__contrat='+ convert(char,@cledepartement)+')'

end
set @ordre = @ordre + ' AND ( Clé_type_poste = '+convert(char,@cletypeposte)+') AND ( Validation=''O''))'

exec(@ordre)


   

- Advertisement -