SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER PROCEDURE AddDataTOSCMTJOBMST(
@in_count INT, --JOBID COUNT
@in_suid VARCHAR(4), --UPD_SUID
@in_company_cd VARCHAR(4) --COMPANY_CD
) AS
BEGIN
DECLARE @p_company_cd VARCHAR(4)
DECLARE @p_job_id VARCHAR(10)
DECLARE @p_job_name VARCHAR(120)
DECLARE @p_success_mail_kbn CHAR(1)
DECLARE @p_err_mail_kbn CHAR(1)
DECLARE @p_nodata_mail_kbn CHAR(1)
DECLARE @p_skip_mail_kbn CHAR(1)
DECLARE @p_bat_file_name VARCHAR(256)
DECLARE @p_dat_file_name VARCHAR(256)
DECLARE @p_style_defi_name VARCHAR(40)
DECLARE @p_err_import_flg CHAR(1)
DECLARE @p_del_flg CHAR(1)
DECLARE @p_ins_suid DECIMAL(13,0)
DECLARE @p_ins_date VARCHAR(10)
DECLARE @p_upd_suid DECIMAL(13,0)
DECLARE @p_upd_date VARCHAR(8)
DECLARE @p_sql VARCHAR(8)
DECLARE @p_index int
DECLARE @p_tempcount varchar(4)
DECLARE @p_tempchar CHAR(2)
DECLARE @p_tempint INT
DECLARE @p_count INT -- execute count
DECLARE @p_save INT
SET @p_save = @in_count
SET @p_count = 1
SET @p_tempcount=''
SELECT @p_tempint = ASCII('A')
SELECT @p_tempchar= char(65)
SET @p_index=1
-- init
SET @p_company_cd = @in_company_cd
SET @p_job_id = ''
SET @p_job_name = ''
SET @p_success_mail_kbn='0'
SET @p_err_mail_kbn='0'
SET @p_nodata_mail_kbn='0'
SET @p_skip_mail_kbn='0'
SET @p_bat_file_name = ''
SET @p_dat_file_name = ''
SET @p_style_defi_name = ''
SET @p_err_import_flg = '1'
SET @p_del_flg = '0'
SET @p_ins_suid = @in_suid
SET @p_upd_suid = @in_suid
SELECT @p_ins_date=getdate()
SELECT @p_upd_date=getdate()
WHILE (@in_count <> 0)
BEGIN
-----------------------------------------------------------
--select @p_tempint = ASCII('A')
if( @p_count > 100 )
BEGIN
SET @p_tempint = @p_tempint + 1
SELECT @p_tempchar = char(@p_tempint)
SET @p_count = 1
SET @p_save = @p_save - 100
SET @p_tempcount = @p_save
END
------------------------------------------------------------
IF(LEN(@p_count) =1)
SET @p_tempcount = '00' + convert(varchar,@p_count)
IF(LEN(@p_count) =2)
SET @p_tempcount = '0' + convert(varchar,@p_count)
IF(LEN(@p_count) =3)
SET @p_tempcount = + convert(varchar,@p_count)
print @p_tempcount
------------------------------------------------------------
SET @p_job_id = '' + @p_tempchar +@p_tempcount
SET @p_job_name = 'job_name' + @p_tempchar + @p_tempcount
SET @p_bat_file_name = 'bat_file_name' + @p_tempchar + @p_tempcount
SET @p_dat_file_name = 'dat_file_name' + @p_tempchar + @p_tempcount
SET @p_style_defi_name = 'style_defi_name' + @p_tempchar + @p_tempcount
------------------------------------------------------------
INSERT INTO SCMTJOBMST VALUES(
@p_company_cd,
@p_job_id,
@p_job_name,
@p_success_mail_kbn,
@p_err_mail_kbn,
@p_nodata_mail_kbn,
@p_skip_mail_kbn,
@p_bat_file_name,
@p_dat_file_name,
@p_style_defi_name,
@p_err_import_flg,
@p_del_flg,
@p_ins_suid,
@p_ins_date,
@p_upd_suid,
@p_upd_date )
--------------------------------------------------------------
SET @in_count = @in_count -1
SET @p_count = @p_count + 1
END
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO