Search code examples
sqlsasteradata

SAS is not properly updating


I have a SAS script that copies data from a view, and saves them to a table. This includes a column that gives the date for when the view was last run (current_date AS sist_oppdatert).

I expected that whenever the SAS script is run, it will get fresh data from the view - with today as the date in column "sist_oppdatert".

This doesn't seem to be the case, as the "sist_oppdatert" column is not being updated. It shows an old date, and I then take it that the data I get are also outdated (haven't found a way to verify). If I run the same SQL code manually directly in Teradata then everything works perfect. Not from SAS, not even with any sort of error. I need this to happen automatically.

So how can I make sure the table is updated daily, with the correct data and date?

SAS script:

proc sql;
connect to teradata 
(user="&user_id_td." password=&pwd. mode=teradata server=gjprodaz connection=global);
execute (
      delete from NL.KUB_2_kundedata_tbl
)
by teradata;
quit;

proc sql;
connect to teradata 
(user="&user_id_td." password=&pwd. mode=teradata server=gjprodaz connection=global);
execute (
    insert into NL.KUB_2_kundedata_tbl
    select distinct * from NL.KUB_2_kundedata
    ;
)
by teradata;
quit;

Solution

  • After a while I realized I didn't have any proof that the scheduling was working at all. I then noticed that the script was run through a different user. I tried running the script with that user, and then it failed with "No more spool space".

    So the whole problem was a property in the schedule user, being different from the manual user.