<?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: How to load large text-fields into SQL-Server with bulkload-option and db-maxlength in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/134299#M260884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand your pain. I do not use the bulk load optionbut this is how I download large fields from the SQL server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For tables with fields uner 32,767 characters I use the following macro; pass trhough query to download from a SQL database. For the field with 200,000 character I wrote code to determine the number of slices required and then generated the required pass through code to run. If anyone knows a better way I would love to here it - cause SAS support says the field has to be split. The way modern systems are produced this limitation is going to be an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** macro to pull all the data from the table ;&lt;/P&gt;&lt;P&gt;%macro PullDataBig (outputdataset,tableName,DatasetLabel);&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CONNECT TO ODBC AS ODBCConnection(NOPROMPT="UID=&amp;amp;GLB_USER;PSW=&amp;amp;GLB_PASSWORD;DSN=&amp;amp;GLB_DSN_NAME;SERVER=&amp;amp;GLB_IP;DATABASE=&amp;amp;GLB_DB"&amp;nbsp; dbmax_text=32767);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create table &amp;amp;outputdataset (compress=binary label="&amp;amp;DatasetLabel") as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select * from connection to ODBCConnection (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From &amp;amp;tableName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Nov 2014 19:20:14 GMT</pubDate>
    <dc:creator>MumSquared</dc:creator>
    <dc:date>2014-11-20T19:20:14Z</dc:date>
    <item>
      <title>How to load large text-fields into SQL-Server with bulkload-option and db-maxlength</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/134298#M260883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have a problem loading datasets, with large text-fields, into SQL-Server using DI-Studio. By generating the tables in SQL-Server we use the datatype "varchar(max)'.&lt;/P&gt;&lt;P&gt;On the SAS-Library we use on the output-tables, we set 2 options:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;in "Advanced Options - Other options" the option "bulkload=yes".&lt;/LI&gt;&lt;LI&gt;in "Advanced Options - Input/Output"&amp;nbsp; maximum text length=32767.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The sas-metadata reads the varchar(max) from SQL-Server as $32767. So far it's OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By running the job the following error occurs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Error binding parameters: [Microsoft][ODBC SQL Server Driver]Invalid field size for datatype&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The combination of library-options mentioned above triggers this Error.&lt;/P&gt;&lt;P&gt;If we disable the bulkload-option, there will be no problem.&lt;/P&gt;&lt;P&gt;If we set the maximum text length =8000 there is also no problem. (Explanation of 8000: this is the default-value that SQL-Server reserver for varchar(max), if necessary SQL-Server will add some extra memory.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can we do to load this large character-fields with the bulkload option?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 15:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/134298#M260883</guid>
      <dc:creator>Jan1204</dc:creator>
      <dc:date>2013-05-16T15:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to load large text-fields into SQL-Server with bulkload-option and db-maxlength</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/134299#M260884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand your pain. I do not use the bulk load optionbut this is how I download large fields from the SQL server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For tables with fields uner 32,767 characters I use the following macro; pass trhough query to download from a SQL database. For the field with 200,000 character I wrote code to determine the number of slices required and then generated the required pass through code to run. If anyone knows a better way I would love to here it - cause SAS support says the field has to be split. The way modern systems are produced this limitation is going to be an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** macro to pull all the data from the table ;&lt;/P&gt;&lt;P&gt;%macro PullDataBig (outputdataset,tableName,DatasetLabel);&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CONNECT TO ODBC AS ODBCConnection(NOPROMPT="UID=&amp;amp;GLB_USER;PSW=&amp;amp;GLB_PASSWORD;DSN=&amp;amp;GLB_DSN_NAME;SERVER=&amp;amp;GLB_IP;DATABASE=&amp;amp;GLB_DB"&amp;nbsp; dbmax_text=32767);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create table &amp;amp;outputdataset (compress=binary label="&amp;amp;DatasetLabel") as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select * from connection to ODBCConnection (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From &amp;amp;tableName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 19:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/134299#M260884</guid>
      <dc:creator>MumSquared</dc:creator>
      <dc:date>2014-11-20T19:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to load large text-fields into SQL-Server with bulkload-option and db-maxlength</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/389014#M260885</link>
      <description>&lt;P&gt;Hi, did you manage to find a solution for this one? I'm currently having the same problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I remove the bulkload I guess it's gonna take very long to insert data when it's 100k+ or even million of records.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 01:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/389014#M260885</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2017-08-18T01:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to load large text-fields into SQL-Server with bulkload-option and db-maxlength</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/389292#M260886</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16582"&gt;@milts&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Please don't post new questions to old tracks but create a new question and reference the old track.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2017 03:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-load-large-text-fields-into-SQL-Server-with-bulkload/m-p/389292#M260886</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-19T03:19:45Z</dc:date>
    </item>
  </channel>
</rss>

