<?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 How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404067#M12293</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use a SAS DI table loader transformation to load into a SQL Server table that is using a sequence value as a default constraint for the PK column. The insert works outside of SAS DI if exclude the PK column from the insert statement and let the default constraint populate the PK column value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS DI even though the PK column is not mapped in the Table Loader mapping the transformation is still generating a insert SQL statement that includes the PK column and a null value which results in the error below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: CLI execute error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert the value NULL into column 'XXXXXXXXXXXXXX_ID', table 'xxxxxxxxxxx'; column does not allow nulls. INSERT fails. : [Microsoft][SQL Server Native Client 11.0][SQL Server]The statement has been terminated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the solution to add the&amp;nbsp;&lt;SPAN&gt;IGNORE_READ_ONLY_COLUMNS=YES&amp;nbsp;to the advanced option of the library definition but I still get the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas on how to accomplish the insert and have the PK column ignored in the insert?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2017 18:29:58 GMT</pubDate>
    <dc:creator>TD2017</dc:creator>
    <dc:date>2017-10-13T18:29:58Z</dc:date>
    <item>
      <title>How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404067#M12293</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use a SAS DI table loader transformation to load into a SQL Server table that is using a sequence value as a default constraint for the PK column. The insert works outside of SAS DI if exclude the PK column from the insert statement and let the default constraint populate the PK column value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS DI even though the PK column is not mapped in the Table Loader mapping the transformation is still generating a insert SQL statement that includes the PK column and a null value which results in the error below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: CLI execute error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert the value NULL into column 'XXXXXXXXXXXXXX_ID', table 'xxxxxxxxxxx'; column does not allow nulls. INSERT fails. : [Microsoft][SQL Server Native Client 11.0][SQL Server]The statement has been terminated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the solution to add the&amp;nbsp;&lt;SPAN&gt;IGNORE_READ_ONLY_COLUMNS=YES&amp;nbsp;to the advanced option of the library definition but I still get the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas on how to accomplish the insert and have the PK column ignored in the insert?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404067#M12293</guid>
      <dc:creator>TD2017</dc:creator>
      <dc:date>2017-10-13T18:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404152#M12294</link>
      <description>If I recall correctly you can't have that column in your table meta data definition.</description>
      <pubDate>Fri, 13 Oct 2017 21:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404152#M12294</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-10-13T21:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404206#M12299</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/164239"&gt;@TD2017&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Is the column explicitly defined as readonly in the SQL Server table? Else: What&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;says.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 10:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404206#M12299</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-14T10:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404249#M12301</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Linus and Patrick for your responses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on your responses and a previous post by "nar_sas" &amp;nbsp;I believe the following are viable solutions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Set the&amp;nbsp;&lt;SPAN&gt;ignore_read_only_columns=yes option on either the library or table definition will prevent the column from being included in the Insert statement BUT this only works if the column is an IDENTITY (i.e. read-only).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This allows the metadata for the table definition to remain complete and the identity column will be auto incremented as expected.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Add a "drop=&amp;lt;ColumnName&amp;gt;" statement into the options on the table load transformation (Options -&amp;gt; Loader* -&amp;gt; Additional data table options) and again the column specific will be excluded from the insert statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This allows the metadata for the table definition to remain complete. In addition this works for both identity columns and those using a sequence and default constraint (i.e. not read-only). Both will be auto incremented as expected. This appears to work for both the Insert (SQL) and Append (Proc Append) News Rows options in the load technique settings.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Alter the metadata for the target table to not include the columns to be excluded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I haven't tested this one yet but I suspect it will get around the issue of the unmapped columns being included in the insert but comes with the side affect of not providing a accurate representation of the table.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 22:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404249#M12301</guid>
      <dc:creator>TD2017</dc:creator>
      <dc:date>2017-10-14T22:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404251#M12302</link>
      <description>&lt;P&gt;It appears there is no way to mark the answers from both&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;as solutions but the credit should go to both as well as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13762"&gt;@nar_sas&lt;/a&gt;&amp;nbsp;from an older post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all!&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 22:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404251#M12302</guid>
      <dc:creator>TD2017</dc:creator>
      <dc:date>2017-10-14T22:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a SAS DI Table Loader to insert into table and ignore un-mapped target columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404256#M12303</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/164239"&gt;@TD2017&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Thanks for taking the time to share the results of your testing.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 00:48:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-use-a-SAS-DI-Table-Loader-to-insert-into-table-and-ignore/m-p/404256#M12303</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-15T00:48:38Z</dc:date>
    </item>
  </channel>
</rss>

