BookmarkSubscribeRSS Feed
Akshay1002
Fluorite | Level 6

Hello,

I'm bulk loading approximately 60 million records to SQL database using EG and it's taking 5 hours to have the job run successfully.

Please suggest me the tips to optimize the run time.

Environment - SAS 9.4 M6, Grid

 

Here is the code:

 

options fullstimer;

libname abc odbc noprompt= "Driver=xxxxx; Server=yyyyy; database=zzzzz; Trusted_connection=Yes" READBUFF=32767 INSERTBUFF=32767 DBCOMMIT=32767 schema=pqr;

libname xyz odbc noprompt= "Driver=xxxxx; Server=yyyyy; database=ggggg; Trusted_connection=Yes" READBUFF=32767 INSERTBUFF=32767 DBCOMMIT=32767 schema=pqr; 

 

proc sql;

drop table xyz.table_name;

quit;

data xyz.table_name;

set abc.table_name;

run;

6 REPLIES 6
ChrisNZ
Tourmaline | Level 20

You are copying from SQL Server to SQL Server. Can't you use explicit pass-through, i.e send pure SQL Server code?

Akshay1002
Fluorite | Level 6
Yes,
We did try the pass through option. The results are still the same.
SASKiwi
PROC Star

Please post your passthru code.

 

Your SAS SQL version indicates you are reading all of your SQL Server data into SAS, then immediately writing it back to SQL Server. With passthru you should be able to read data directly from one SQL Server table and write it into another without extracting it to SAS.

Akshay1002
Fluorite | Level 6
I'll post the pass through code soon. Sorry about the delay.

Is it true that we need SAS/ACCESS to SQLServer engine inorder to bulkload data into SQL databases? And we don't have it in our environment.
ChrisNZ
Tourmaline | Level 20

You don't need BULKLOAD here as the source data is not SAS. You should be able to have all the data stay within SQL Server's realm.

Patrick
Opal | Level 21

Ideally don't move the data from SQL Server to SAS to SQL Server but just insert from one SQL server table into another SQL server table - and as you don't move data in and out of SQL server you also don't need bulk-load.

Untested but some code like below could do the job. Basically: Develop your code directly in SQL and then just copy/paste the working script into a SAS pass-through Execute block.

libname xyz odbc noprompt= "Driver=xxxxx; Server=yyyyy; database=ggggg; Trusted_connection=Yes" schema=pqr; 

proc sql;
  connect using xyz;
  execute 
  (
    INSERT INTO pqr.TargetTable
       SELECT *
       FROM zzzzz.pqr.SourceTable
; ) by xyz ; quit;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1294 views
  • 0 likes
  • 4 in conversation