BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
BaileyY
Obsidian | Level 7

Hello,

 

I am trying to upload around 7 million data record rows into a SQL Server database.  It is taking over 3 hours and the job is still running.    Any help would be greatly appreciated.  I do not have any special code that I am writing into SQL.  Its just basically a SAS temp table uploading into SQL Server database. 

 

My code is simply this : 

Data Server1.DiagnosisTable;

Set DiagnosisTable; Run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Setting the INSERTBUFF option to a value of at least 10000 should speed things up drastically. Usually you apply that on the LIBNAME statement connecting to SQL Server. Database inserts are best done with PROC DATASETS and the APPEND statement in my experience.

View solution in original post

6 REPLIES 6
SASKiwi
PROC Star

Setting the INSERTBUFF option to a value of at least 10000 should speed things up drastically. Usually you apply that on the LIBNAME statement connecting to SQL Server. Database inserts are best done with PROC DATASETS and the APPEND statement in my experience.

BaileyY
Obsidian | Level 7
OMFG- using this and the proc copy as suggested by KSharp reduced my data upload time from 5 hours to just 10 minutes. thank you so very very much.
jennifertaylor
Calcite | Level 5

Increase the INSERTBUFF option (≥10000) on your LIBNAME to speed up inserts. Using PROC DATASETS with APPEND is usually the fastest method.

Ksharp
Super User
And PROC COPY could get you faster:

proc copy in=work out=Server1;
select DiagnosisTable;
run;
BaileyY
Obsidian | Level 7
Thank you so very much. Using the InsertBuffer along with this proc copy dropped my upload time from hours to just 10 minutes. Thank you so so much!!
SASKiwi
PROC Star

That sounds good for 5 million rows.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 399 views
  • 5 likes
  • 4 in conversation