From ce503653cd9fc36f72fb172bd14816e07c792e14 Mon Sep 17 00:00:00 2001 From: allan Date: Sat, 31 Aug 2024 16:19:04 +0200 Subject: [PATCH] fix: using temporary names for temporary tables Closes #124 --- sas/sasjs/macros/bitemporal_dataloader.sas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sas/sasjs/macros/bitemporal_dataloader.sas b/sas/sasjs/macros/bitemporal_dataloader.sas index 1a8ba55..8b47503 100755 --- a/sas/sasjs/macros/bitemporal_dataloader.sas +++ b/sas/sasjs/macros/bitemporal_dataloader.sas @@ -100,6 +100,7 @@ Areas for optimisation @li mf_getattrn.sas @li mf_getengine.sas @li mf_getschema.sas + @li mf_getuniquefileref.sas @li mf_getuniquename.sas @li mf_getuser.sas @li mf_getvarlist.sas @@ -621,7 +622,7 @@ data work.bitemp0_append &keepvars &outds_del(drop=&md5_col ) %put DCNOTE: Extracting matching observations from &base_lib..&base_dsn; %if &engine_type=OLEDB %then %do; - %let temp_table=##BITEMP_&base_dsn; + %let temp_table=##%mf_getuniquefileref(prefix=BTMP)_&base_dsn; %if &loadtype=BITEMPORAL or &loadtype=TXTEMPORAL %then %let base_table=(select * from [dbo].&base_dsn where convert(datetime,&SQLNOW) < &tech_to ); @@ -1049,7 +1050,7 @@ run; %let cat_string=catx('|' ,&bus_from,&bus_to); data work.bitemp5a_lkp (keep=&md5_col) - %if "%substr(&sysver,1,1)" ne "4" and "%substr(&sysver,1,1)" ne "5" %then %do; + %if "%substr(&sysver,1,1)" ne "4" & "%substr(&sysver,1,1)" ne "5" %then %do; /nonote2err %end; ; @@ -1191,10 +1192,10 @@ run; /* if OLEDB then create a temp table for efficiency */ %local innertable; %if &engine_type=OLEDB %then %do; - %let innertable=[##BITEMP_&base_dsn]; + %let innertable=[&temp_table]; %let top_table=[dbo].&base_dsn; %let flexinow=&SQLNOW; - create table &base_lib.."##BITEMP_&base_dsn"n as + create table &base_lib.."&temp_table"n as select * from work.bitemp5d_subquery; /* open up a connection for pass through SQL */ %dc_assignlib(WRITE,&base_lib,passthru=myAlias)