Hi Guys,
I have the following code in the Enterprise Job Scheduler and it runs successfully but the table is not updated. I first put it into a stored procedure but when they did not work, I put just the code to insert the records directly into the scheduler. Its supposed to update nightly at 5am, but when I run my crystal report the next day, nothing in the table was updated. Please help!
This is SQL script. I do not know any other coding practices. - JO
insert into NewCustomers
select cust.c_id_alpha Location_ID, cust.c_name Location_name,
substring (CUST.c_name, CHARINDEX('#', CUST.c_name)+1, ((len(CUST.c_na me) - (len(CUST.c_Nam e) - CHARINDEX('#', CUST.c_name)))) ) Store_no,
C_ADDRNUM1, C_ADDR1, C_ADDR2,
C_CITY, C_STATE, C_ZIP, C_PHO, C_FAX Cust_Fax_No, c_pcont Cust_Contact, null, cmpy.company
FROM cust inner join udef_active_cst at ud on cust.c_cstat = ud.unique_id
left join dbo.ups_keepers k on cust.c_id = k.c_id
inner join cmpy on cust.b_bill_co = cmpy.cmpy_id
where right(cust.c_id _alpha, 3) <> '001'
and b_bill_co not in (30,2,26,29,4)
and c_quote >= getdate()-1
update NewCustomers
set Standard_Instru ctions = rxrf.comment
FROM cust inner join udef_active_cst at ud on cust.c_cstat = ud.unique_id
left join dbo.ups_keepers k on cust.c_id = k.c_id
inner join rxrf on cust.c_id = rxrf.c_id
inner join cmpy on cust.b_bill_co = cmpy.cmpy_id
inner join NewCustomers L on L.Location_id = cust.c_id_alpha
where right(cust.c_id _alpha, 3) <> '001'
and b_bill_co not in (30,2,26,29,4)
and c_quote >= getdate()-1
update NewCustomers set c_pho = replace(c_pho, '-', '')
update NewCustomers set c_pho = replace(c_pho, ')', '')
update NewCustomers set c_pho = replace(c_pho, '(', '')
update NewCustomers set c_pho = replace(c_pho, ' ', '')
update NewCustomers set c_zip = replace(c_zip, '-', '')
update NewCustomers set cust_FAX_no = replace(cust_fa x_no, '-', '')
I have the following code in the Enterprise Job Scheduler and it runs successfully but the table is not updated. I first put it into a stored procedure but when they did not work, I put just the code to insert the records directly into the scheduler. Its supposed to update nightly at 5am, but when I run my crystal report the next day, nothing in the table was updated. Please help!
This is SQL script. I do not know any other coding practices. - JO
insert into NewCustomers
select cust.c_id_alpha Location_ID, cust.c_name Location_name,
substring (CUST.c_name, CHARINDEX('#', CUST.c_name)+1, ((len(CUST.c_na me) - (len(CUST.c_Nam e) - CHARINDEX('#', CUST.c_name)))) ) Store_no,
C_ADDRNUM1, C_ADDR1, C_ADDR2,
C_CITY, C_STATE, C_ZIP, C_PHO, C_FAX Cust_Fax_No, c_pcont Cust_Contact, null, cmpy.company
FROM cust inner join udef_active_cst at ud on cust.c_cstat = ud.unique_id
left join dbo.ups_keepers k on cust.c_id = k.c_id
inner join cmpy on cust.b_bill_co = cmpy.cmpy_id
where right(cust.c_id _alpha, 3) <> '001'
and b_bill_co not in (30,2,26,29,4)
and c_quote >= getdate()-1
update NewCustomers
set Standard_Instru ctions = rxrf.comment
FROM cust inner join udef_active_cst at ud on cust.c_cstat = ud.unique_id
left join dbo.ups_keepers k on cust.c_id = k.c_id
inner join rxrf on cust.c_id = rxrf.c_id
inner join cmpy on cust.b_bill_co = cmpy.cmpy_id
inner join NewCustomers L on L.Location_id = cust.c_id_alpha
where right(cust.c_id _alpha, 3) <> '001'
and b_bill_co not in (30,2,26,29,4)
and c_quote >= getdate()-1
update NewCustomers set c_pho = replace(c_pho, '-', '')
update NewCustomers set c_pho = replace(c_pho, ')', '')
update NewCustomers set c_pho = replace(c_pho, '(', '')
update NewCustomers set c_pho = replace(c_pho, ' ', '')
update NewCustomers set c_zip = replace(c_zip, '-', '')
update NewCustomers set cust_FAX_no = replace(cust_fa x_no, '-', '')
Comment