Here is the complete code. It works and inserts the date when I use code 112, but not when I use 121 or 108. I think it has to do with "-" or ":".declare @DateTime varchar(50)set @DateTime = convert(varchar(50), current_timestamp, 108)
begin transactionexec('insert into ZyTax.dbo.ttable( report_state, report_year, report_month, company, destination_county, carrier_name, carrier_fein, mode_code, origin_name, origin_city, origin_state, origin_code, destination_name, destination_city, destination_state, destination_code, consignor_name, consignor_fein, buyer_name, buyer_fein, seller_name, seller_fein, manifest_date, manifest, net, gross, billed, product, business_event, terms, effective_date, invoice_number, invoice_date, dest_splc, carrier_scac, origin_splc, taxtype, transtype, recordtype, fuelusetype, position_holder, position_fein, ok_to_import, seller_qualifier, origin_option, cons_qualifier, carrier_qualifier, buyer_qualifier, dest_option, div_dest_name, div_dest_option, div_dest_id_code, div_dest_state, div_dest_city, div_dest_county, div_dest_zip, destination_dep, destination_license, load_flag, scrubbed_flag, origin_county, div_number, imp_ver_number, seller_control_name, cons_control_name, carrier_control_name, buyer_control_name, destination_zip, origin_zip, seller_637, purchase_date, receipt_date, freight_paid_by, vehicle_make, vehicle_no, vehicle_model, vehicle_license, vehicle_beg_odo, vehicle_end_odo, vehicle_miles, credit_memo_no, credit_memo_date, cc_no, flight_no, flight_date, flight_stop, memo_fueluse, prod_subtype, dest_license_type, buyer_st_id, seller_st_id, carrier_st_id, cons_st_id, buyer_st_id_type, seller_st_id_type, carrier_st_id_type, cons_st_id_type, ca_oper_dsl_no, loc_code, exempt_code, useruid, sold_to_customer_no, ship_to_customer_no, payer_customer_no, source_document_no, taxable_gallons, position_qualifier, position_control_name, position_637, orig_jurisdiction_2, dest_jurisdiction_2, gal_price, prod_converted, prod_blended_1, prod_blended_2, date_shipped, tax_collected, airport_fuel_sold_to, name_auth_purchaser, title_auth_purchaser, unpaid_special_tax, div_dest_splc, buyer_state, buyer_city, seller_state, seller_city, origin_custom_id_code, dest_custom_id_code, div_dest_custom_id_code, sched_type, exemption_type, tax1_exempt, tax2_exempt, tax3_exempt, tax4_exempt, tax5_exempt, tax6_exempt, tax7_exempt, tax8_exempt, tax9_exempt, tax10_exempt, tax11_exempt, blend_1_gross, blend_1_net, blend_1_billed, blend_2_gross, blend_2_net, blend_2_billed, blend_3_gross, blend_3_net, blend_3_billed, base_prod_gross, base_prod_net, base_prod_billed, prod_blended_3, self_carried_flag, borderzone_flag, schedule_code, exchange_flag, customer_key, sched_category, alt_mode_code, company_owned, taxes_applied, original_product, exemption_type_2, sched_category_2, company_taxpayertype, origin_dep_number, origin_address1, origin_address2, dest_address1, dest_address2, position_st_id, position_st_id_type, buyer_street, seller_street, origin_street, destination_street, div_dest_street, buyer_address1, buyer_address2, seller_address1, seller_address2, div_dest_address1, div_dest_address2, vehicle_license_state, exchange_position_holder, exchange_position_fein, exchange_position_qualifier, exchange_position_control_name, exchange_position_holder_637, exchange_position_st_id, exchange_position_st_id_type, error_status, dest_country, origin_country, origin_license, origin_license_type, custom1 --, --custom2, custom3, custom4, custom5 ) Select ztadds, ztyear, zt#mt, ztco, ztdl01, ztdsc, ztein, ztmot, ztdl02, ztcity, ztrp14, ztzip, ztdl03, ztdl04, ztssst, ztvvz, ztdsc1, ztcein, ztdsc2, ztbein, ztdsc3, ztsein, zt#dsc, zt#ds2, ztnetg, ztqty, zttot$, ztprd1, ztbev, ztterm, convert(datetime,ztdef,110), ztinv#, convert(datetime,ztdtsp,110), ztds, ztcrrt, ztorsp, zttxty, zttrty, ztrcty, ztftyp, ztpohd, ztpein, ztokim, ztsllq, ztogop, ztcqua, ztcrrq, ztbuyq, ztdeso, ztdidn, ztdivo, ztdivi, ztdivs, ztdivc, ztdict, ztdivz, ztdsdp, ztdsli, ztlflg, ztsflg, ztorct, ztdivn, ztivrn, ztslcn, ztccna, ztcrrc, ztbcn, ztdesz, ztogzp, zts637, convert(datetime,ztpodt, 110), convert(datetime,ztrcdt, 110), ztfpby, ztdl05, ztvnum, ztmod, ztvlic, ztvbod, ztveod, ztvmil, ztcme#, convert(datetime,ztcmdt, 110), ztccno, ztflg#, convert(datetime,ztflgd, 110), ztflgs, ztmemf, ztpdty, ztdelt, ztbsti, ztssti, ztcsti, ztcnsi, ztbstt, ztsstt, ztcstt, ztcnst, ztcodn, ztlocc, ztexcd, ztuuid, ztcust, ztscus, ztpcus, ztsdoc, zttxgl, ztpoq, ztpocn, ztp637, ztogju, ztdsju, ztglpr, ztpdcv, ztpdb1, ztpdb2, ztdats, zttxcl, ztafst, ztaupu, zttupu, ztustx, ztddsp, ztbst, ztbcty, ztssta, ztscty, ztogcc, ztdscc, ztdvcc, ztscht, ztexty, ztext1, ztext2, ztext3, ztext4, ztext5, ztext6, ztext7, ztext8, ztext9, ztex10, ztex11, ztbl1g, ztbl1n, ztbl1b, ztbl2g, ztbl2n, ztbl2b, ztbl3g, ztbl3n, ztbl3b, ztbspg, ztbspn, ztbspb, ztpdb3, ztscfg, ztbzfg, ztschc, ztexfg, ztcuky, ztscct, ztaltm, ztcoow, zttxap, ztogpd, ztety2, ztsca2, ztcotx, ztogdn, ztoga1, ztoga2, ztdes1, ztdes2, ztpsid, ztpsty, ztbust, ztslst, ztogst, ztdsst, ztdvst, ztbad1, ztbad2, ztsad1, ztsad2, ztdad1, ztdad2, ztvlst, ztephl, ztepei, ztepql, ztepcn, zte637, ztepid, ztepty, ztests, ztdcty, ztogty, ztogli, ztoglt, ' + @DateTime + ' from AS400SRV_MSDASQL.VGSYS400.' + @AliasLibrary + '.' + @SourceFile) COMMIT TRANSACTIONif @@error <> 0begin set @RetValue = 'Error: upload to ZyTax failed' set @InsertOK = 0 -- false endError: Incorrect syntax near ':'