My stored procedure in SQL Server 2008 when is execute with JOB its fails, but without its working great -
i have stored procedure wich :
alter procedure [dbo].[p_alimentation_volumeventes] begin select eds, nomeds,agenceeds, agencenomeds,secteureds, secteurnomeds,directioneds,directionnomeds, (select count(*) cplisteventesnonconformes cplisteventesnonconformes.eds = cprt.eds , typepart='pp') listeventenc_pp, (select count(*) celisteventesnonconformes celisteventesnonconformes.eds = cprt.eds , typepart='et') listeventenc_et, (select count(*) cplisteventesnonconformes cplisteventesnonconformes.eds = cprt.eds , typepart='pp' or typepart='et') listeventenc_ppet, (select count(*) listeventes ides01 = cprt.eds , typepart='pp') listeventes volumeventes cpr cprt group eds, nomeds,agenceeds, agencenomeds,secteureds, secteurnomeds,directioneds,directionnomeds,typepart end
when execute command line exec [dbo].[p_alimentation_volumeventes] work super great table create.
but when use sql agent schedule job have nice surprise have error :
executed user: zres\csaprep10iucradm. conversion of varchar data type datetime data type resulted in out-of-range value. [sqlstate 22007] (error 242) statement has been terminated. [sqlstate 01000] (error 3621). step failed.
the structure table create volumetventes have no fields type datetime
here structure of tablevolumeventes
i don't understand error ?
thank help
actually should never work since have volumevente
table.
select into
creates new table columns described in select statement https://msdn.microsoft.com/en-us/library/ms188029(v=sql.120).aspx
you should modify code become insert select
.
but still same conversion error because (i guess) column order not correct in select statment , not match column order in existing table. why should explicitly define column list in insert into
clause, final script like:
insert volumeventes(eds, nomeds,agenceeds, agencenomeds,secteureds, ...) select eds, nomeds,agenceeds, agencenomeds,secteureds ...
Comments
Post a Comment