Forse questo č il forum giusto
Ho la seguente stored procedure che aggancio per fare delle cosette :
ALTER procedure DBA.InserimentoLav(in @NumDocum integer,in @DataDoc integer,in @Tipo varchar(15),in @Stato integer,in @Lavorazione varchar(50),in @Note varchar(50),in @Ricambi varchar(50),in @TempViag integer,in @Tempo integer,in @Tempo3 integer,in @TempViag2 integer,in @Conv4 varchar(23),in @Conv varchar(23),in @Conv3 varchar(23),in @Conv5 varchar(23),in @Esecutore varchar(30),inout @ErrDesc integer)
on exception resume
begin
declare @appo integer;
declare @NumEsecutore integer;
declare @NumLav integer;
declare @NumRipri integer;
declare @NumMax integer;
declare @TempRip integer;
set @ErrDesc=1;
if @Stato = 0 then
set @ErrDesc=2
end if;
if @conv = 'ok' and @conv3 = 'ok' and @conv4 = 'ok' and @conv5 = 'ok' then
set @appo=2
end if;
if @TempViag >= @Tempo then
set @ErrDesc=3
end if;
if @Tempo >= @Tempo3 then
set @ErrDesc=4
end if;
if @TempViag2 <> 0 then
if @Tempo3 >= @TempViag2 then
set @ErrDesc=5
end if
end if;
if @ErrDesc = 1 then
select(1+max(Numero)) into @NumMax from LAVRAP14;
select count(*) into @NumLav from LAVRAP14 where NumDocum = @NumDocum;
select Codice1 into @NumEsecutore from operat14 where Nome = @Esecutore;
select count(*) into @NumRipri from LAVRAP14 where Tempo2 <> 0 and NumDocum = @NumDocum;
insert into LAVRAP14(Numero,
NumDocum,
DataDoc,
Tipo,
Stato,
Lavorazione,
Note,
Visite,
Ricambi,
Tempo,
Tempo2,
Tempo3,
Esecutore,
TempViag,
TempViag2,
Operatore)
select @NumMax,
@NumDocum,
@DataDoc,
@Tipo,
@Stato,
@Lavorazione,
@Note,
1,
@Ricambi,
@Tempo,
@Tempo3,
@Tempo3,
@Esecutore,
@TempViag,
@TempViag2,
@NumEsecutore;
if @Stato = 3 then
if @NumRipri > 0 and @NumLav = 0 then
update RAPPOR14 set
Stato = @Stato,
Tempo = @Tempo,
Tempo3 = @Tempo3,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
elseif @NumRipri = 0 and @NumLav = 0 then
update RAPPOR14 set
Stato = @Stato,
Tempo = @Tempo,
Tempo2 = @Tempo3,
Tempo3 = @Tempo3,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
elseif @NumRipri = 0 and @NumLav > 0 then
update RAPPOR14 set
Tempo3 = @Tempo3,
Tempo2 = @Tempo3,
Stato = @Stato,
Visite = (Visite+1),
Esecutore = @Esecutore,
Operatore = @NumEsecutore,
UltimaLav = @Lavorazione where
Numero = @NumDocum
elseif @NumRipri > 0 and @NumLav > 0 then
update RAPPOR14 set
Stato = @Stato,
Tempo3 = @Tempo3,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
end if
elseif @Stato = 1 then
if @NumLav = 0 then
update RAPPOR14 set
Stato = @Stato,
Tempo = @Tempo,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
elseif @NumLav > 0 then
update RAPPOR14 set
Stato = @Stato,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
end if
elseif @Stato = 2 then
if @NumRipri > 0 and @NumLav = 0 then
update RAPPOR14 set
Stato = @Stato,
Tempo = @Tempo,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
elseif @NumRipri = 0 and @NumLav = 0 then
update RAPPOR14 set
Stato = @Stato,
Tempo = @Tempo,
Tempo2 = @Tempo3,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
elseif @NumRipri = 0 and @NumLav > 0 then
update RAPPOR14 set
Tempo2 = @Tempo3,
Stato = @Stato,
Visite = (Visite+1),
Esecutore = @Esecutore,
Operatore = @NumEsecutore,
UltimaLav = @Lavorazione where
Numero = @NumDocum
elseif @NumRipri > 0 and @NumLav > 0 then
update RAPPOR14 set
Stato = @Stato,
Visite = (Visite+1),
UltimaLav = @Lavorazione,
Esecutore = @Esecutore,
Operatore = @NumEsecutore where
Numero = @NumDocum
end if
end if
end if
end
Ora vorrei fare si che, come in asp mi costruisco la select leggendo una variabile da un file di testo, anche nelle stored procedure avvenga cio', in pratica voglio che ad esempio questo:
select count(*) into @NumLav from lavrap14where NumDocum =
diventi
select count(*) into @NumLav from LAVRAP'VARIABILE' where NumDocum =
Stavolta mi sā che non si puo' fare č?
Ciao a tutti

Rispondi quotando