<?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: Insert into a SQL table with identity column from DI Studio in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/375559#M11411</link>
    <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could not find any attachment with your post. If possible, could you please provide me the attachment?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2017 03:19:19 GMT</pubDate>
    <dc:creator>Balli</dc:creator>
    <dc:date>2017-07-13T03:19:19Z</dc:date>
    <item>
      <title>Insert into a SQL table with identity column from DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10857#M18</link>
      <description>I would like to know how can I insert into a SQL table with identity column using DI studio? I know this can be done in SQL using SET IDENTITY_INSERT [LOG] ON/OFF.&lt;BR /&gt;
Any suggestion?</description>
      <pubDate>Wed, 16 Feb 2011 00:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10857#M18</guid>
      <dc:creator>gn</dc:creator>
      <dc:date>2011-02-16T00:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into a SQL table with identity column from DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10858#M19</link>
      <description>We are still researching this question, but here is some information. We are researching if the DI Studio loader can be made to generate this code for you.  In the meantime, here are some options to explore.  These are a couple of ways to  accomplish this, and there may be others.  We will post again once we have investigated the loader option.  &lt;BR /&gt;
&lt;BR /&gt;
1.  You can use proc append to insert rows into an RDBMS table that includes sequence (auto number) .  To accomplish this, simply drop the column from the base table when appending.&lt;BR /&gt;
&lt;BR /&gt;
Example:&lt;BR /&gt;
&lt;BR /&gt;
proc append base=target.my_target(drop=SQL_ID)&lt;BR /&gt;
                          data=source.my_source;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
This syntax would not actually result in physically dropping the column SQL_ID from the target table.  Instead, this will result in preparing the SQL insert query correctly by not including a reference to the SQL_ID column in the prepared query.&lt;BR /&gt;
&lt;BR /&gt;
This method should work for other RDBM’s that support sequences such as DB2, Oracle and Teradata.  &lt;BR /&gt;
&lt;BR /&gt;
2.  One other method would be to add pre/post process to turn off and then turn on sequencing.  An explicit pass-through query turning off sequencing could be executed in a pre-process step.  A post-process query would then turn sequencing on.&lt;BR /&gt;
&lt;BR /&gt;
note:  The proc append method would be a less complicated method as you would not have to turn sequencing off and on.</description>
      <pubDate>Fri, 18 Feb 2011 16:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10858#M19</guid>
      <dc:creator>nar_sas</dc:creator>
      <dc:date>2011-02-18T16:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into a SQL table with identity column from DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10859#M20</link>
      <description>Thanks for the response, although I need a bit more clarification on option 2.</description>
      <pubDate>Fri, 18 Feb 2011 17:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10859#M20</guid>
      <dc:creator>gn</dc:creator>
      <dc:date>2011-02-18T17:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into a SQL table with identity column from DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10860#M21</link>
      <description>It is pretty easy, first in SAS when you create your connection turn on the ignore_read_only_columns in SAS management console  when you setup the Libname it is just a libname option, by default it is set to NO. It is counter intuitive but by ignore_read_only_columns = yes lets SAS ignore mapping stuff to identity columns. &lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
libname srv odbc user=maimes pass=’XXXX’ DATASRC=SQLServerExpress &lt;B&gt;ignore_read_only_columns=yes;&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
in your job use a loader and just don't map anything to your identity column &lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;
I attached a doc with some screen shots and info on how to use sequences as well.</description>
      <pubDate>Fri, 18 Feb 2011 21:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10860#M21</guid>
      <dc:creator>Michael_SAS</dc:creator>
      <dc:date>2011-02-18T21:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into a SQL table with identity column from DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10861#M22</link>
      <description>thx much Michael. Really helpful.</description>
      <pubDate>Fri, 18 Feb 2011 21:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/10861#M22</guid>
      <dc:creator>gn</dc:creator>
      <dc:date>2011-02-18T21:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into a SQL table with identity column from DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/375559#M11411</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could not find any attachment with your post. If possible, could you please provide me the attachment?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 03:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Insert-into-a-SQL-table-with-identity-column-from-DI-Studio/m-p/375559#M11411</guid>
      <dc:creator>Balli</dc:creator>
      <dc:date>2017-07-13T03:19:19Z</dc:date>
    </item>
  </channel>
</rss>

