<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get data into sql server more efficiently? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95564#M257702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am dealing with data that is only a few thousand rows, however there are over 80 tables, and each table has about 200-300 columns, of which the average length is &amp;gt; 3,000 varchar text length. These are the tables I would like to load in a much quicker fashion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHen using proc append to the library, do I need to define bulkload on the libname statment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also SAS Kiki and Tom. The issue I have is why would any of these method be inherently more efficient? I'd like to understand how bulk-loading works when defined in the Libname statement compared to the other options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;LIbname mylib odbc dsn='mydsn' bulkload=yes;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this line attempt to use the databases bulk load tool? I do not believe it does, because we are not creating a flat file from with the bulk load can read from. Or am I mistaken in this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Jun 2013 18:18:27 GMT</pubDate>
    <dc:creator>Anotherdream</dc:creator>
    <dc:date>2013-06-07T18:18:27Z</dc:date>
    <item>
      <title>Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95560#M257698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all. I have numerous pieces of code that write data into a sql server database from SAS. I usually do this by using simple proc sql steps to either create a table, or insert into a table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It was recently brought to my attention that when sas does this, it is actually inserting data row by row, and this is why this process is so slow. They instead suggested the bulk load facility within SAS/Access that writes data to a flat file, and then loads the data into sql server from this flat file. However when reading online I am very confused between the different between this process, and using the bulkload=yes option in a libname statment?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a more efficient way to load data into a sql server table (from a sas licence running on a local machine in the same geographical location as the sql server server) then specifying the bulkload=yes option in the libname, as below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname consent odbc dsn=my_defined_odbc_connection schema=dbo bulkload=yes DBMAX_TEXT=32000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table consent.mytable as&lt;/P&gt;&lt;P&gt;select * &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;from sasworktable&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the dataset option bulkload a more efficient way to load data into the server? (as my second example?), or are thees inherently doing the same thing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname consent odbc dsn=my_defined_odbc_connection schema=dbo&amp;nbsp; DBMAX_TEXT=32000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data consent.mytable(bulkload=yes);&lt;/P&gt;&lt;P&gt;set sasworktable;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks for all your help! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 23:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95560#M257698</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-06-04T23:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95561#M257699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A suggest you also look at trying the DBCOMMIT =&amp;nbsp; and INSERTBUFF = options on your LIBNAME statement. These can be used instead of BULKLOAD. The default for DBCOMMIT is 1000 which typically is not very efficient. Try 10,000 and 100,000 and see if there is a significant performance improvement. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 00:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95561#M257699</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2013-06-05T00:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95562#M257700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Although it is impossible to say with certainty that bulk loading will be significantly faster, as it depends on cases, in some testing I did with another DBMS it was a dramatic improvement. It's certainly worth testing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 15:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95562#M257700</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-06-05T15:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95563#M257701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We usually run a truncate on the DBMS data and then a PROC APPEND to reload the entire table content.&amp;nbsp; Of course this would depend on the size of the database.&amp;nbsp; I find that this runs a lot faster for the databases that we deal with which aren't too large.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 15:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95563#M257701</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2013-06-05T15:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95564#M257702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am dealing with data that is only a few thousand rows, however there are over 80 tables, and each table has about 200-300 columns, of which the average length is &amp;gt; 3,000 varchar text length. These are the tables I would like to load in a much quicker fashion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHen using proc append to the library, do I need to define bulkload on the libname statment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also SAS Kiki and Tom. The issue I have is why would any of these method be inherently more efficient? I'd like to understand how bulk-loading works when defined in the Libname statement compared to the other options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;LIbname mylib odbc dsn='mydsn' bulkload=yes;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this line attempt to use the databases bulk load tool? I do not believe it does, because we are not creating a flat file from with the bulk load can read from. Or am I mistaken in this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 18:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95564#M257702</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-06-07T18:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95565#M257703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no experience with SQL server, but for Oracle and Teradata SAS will insulate you from the details of how it performs the bulkload.&amp;nbsp; It can generate the text files and call the bulkloading utility from the database vendor.&amp;nbsp; I suggest doing some testing using your actual data and server.&amp;nbsp; You might also want to look at other settings such as block size.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 18:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95565#M257703</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-06-07T18:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95566#M257704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't use buk loading, SAS will execute an INSERT SQL statement for every record it loads. This is almost always the slowest way to add large quantities of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case where I tested bulk loading with another DBMS, SAS did indeed unload the data to a flat file, and then run the DBMS's bulk loading facility. I was able to watch the flat file grow in one of the SAS utility libraries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is very much worth giving a try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 19:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95566#M257704</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-06-07T19:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95567#M257705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am using bulkload=yes in my libname statement (as defined below)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname consent odbc dsn=my_defined_odbc_connection schema=dbo bulkload=yes DBMAX_TEXT=32000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to determine definitively if my system is using the systems bulkload facility? Aka how would I find SAS utility library that it would load the flat file too, and then load into the system? I guess my main question is how to be sure that the bulkload is actually doing a bulkload (what if the sql server database doesn't have the bulkload facility set up, or if it has permission issues that I don't have access too, etc..).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 20:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95567#M257705</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-06-07T20:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get data into sql server more efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95568#M257706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two things you can do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Check out the SASTRACE system option. It will log the calls that SAS makes to the DBMS. So, try it without the bulk load option, and fiddle with it 'till you see a bunch of INSERT statements. Then, when you're using the bulk loader, you shouldn't see them any more. I'm not sure if bulk loader SQL is written to this or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Run the following statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;libname work list; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;You'll see something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Libref=&amp;nbsp;&amp;nbsp; WORK &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Scope=&amp;nbsp;&amp;nbsp;&amp;nbsp; IOM ROOT COMP ENV&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Engine=&amp;nbsp;&amp;nbsp; V9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Access=&amp;nbsp;&amp;nbsp; TEMP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Physical Name= C:\Users\user\AppData\Local\Temp\SEG2116\SAS Temporary Files\stuff\Prc2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename= C:\Users\user\AppData\Local\Temp\SEG2116\SAS Temporary Files\stuff\Prc2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Somewhere around that directory is probably where SAS will write the flat file that it will feed to the loader. If you transfer a big enough file, you'll probably be able to see it growing. Note that you need to do the "libname work list" in the same SAS session as you do the bulk load; this directory changes with every SAS session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 22:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-data-into-sql-server-more-efficiently/m-p/95568#M257706</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-06-07T22:12:22Z</dc:date>
    </item>
  </channel>
</rss>

