<?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: Setting Foreign Key constraints with Database Connectivity Toolkit in NI TestStand</title>
    <link>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1905625#M36498</link>
    <description>&lt;P&gt;Oops, it looks like I posted this to the wrong board. -- Sorry about that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Still, if anyone has some ideas...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2012 01:53:55 GMT</pubDate>
    <dc:creator>BetterVIEW</dc:creator>
    <dc:date>2012-03-08T01:53:55Z</dc:date>
    <item>
      <title>Setting Foreign Key constraints with Database Connectivity Toolkit</title>
      <link>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1905615#M36497</link>
      <description>&lt;P&gt;Greetings Wire-Folk,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting into an area with the Database Connectivity Toolkit that lies outside of my usual LV comfort zone. We need to build DB tables dynamically in LabVIEW, and due to the complexity of the normalized DB design, several of the tables require Foreign Key refererences.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The normalized schema has been constructed using the (open source) MySQL Workbench. However, the target DB must run under MS SQL Server, and some of the tables will need to be constructed and "dropped" at run-time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To illustrate the format, here is an example of one of the smaller tables we must create:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CREATE&amp;nbsp; TABLE IF NOT EXISTS `BFSH`.`Operator_Event` (&lt;BR /&gt;&amp;nbsp;`OperatorEvent_ID` INT NOT NULL AUTO_INCREMENT ,&lt;BR /&gt;&amp;nbsp;`Operator_ID` INT NOT NULL ,&lt;BR /&gt;&amp;nbsp;`EventType_ID` INT NOT NULL ,&lt;BR /&gt;&amp;nbsp;`EventTime` DATETIME NOT NULL ,&lt;BR /&gt;&amp;nbsp;`EventComment` VARCHAR(100) NOT NULL ,&lt;BR /&gt;&amp;nbsp;PRIMARY KEY (`OperatorEvent_ID`) ,&lt;BR /&gt;&amp;nbsp;INDEX `EventType_ID` (`EventType_ID` ASC) ,&lt;BR /&gt;&amp;nbsp;UNIQUE INDEX `OperatorEvent_ID_UNIQUE` (`OperatorEvent_ID` ASC) ,&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CONSTRAINT `Operator_ID`&amp;nbsp;&amp;nbsp; FOREIGN KEY (`Operator_ID` )&lt;BR /&gt;REFERENCES `BFSH`.`Operator` (`Operator_ID` )&lt;BR /&gt;ON DELETE NO ACTION&lt;/P&gt;
&lt;P&gt;ON UPDATE NO ACTION,&lt;BR /&gt;&lt;BR /&gt;CONSTRAINT `EventType_ID` FOREIGN KEY (`EventType_ID` )&lt;BR /&gt;REFERENCES `BFSH`.`Operator_Event_Type` (`EventType_ID` )&lt;BR /&gt;ON DELETE NO ACTION&lt;BR /&gt;ON UPDATE NO ACTION)&lt;BR /&gt;&lt;BR /&gt;ENGINE = InnoDB;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "DB Tools Create Table" VI has been effective for dynamically creating the tables, but it doesn't appear to have a mechnism for adding Foreign Key constraints at build time. Am I missing something? Is there a way to use this VI that I'm missing? Perhaps another VI must be used to add constraints to the tables after construction? (I have looked in the DBCT "advanced palette", and have seen nothing that appears to be related to constraints, but I must admit that I'm only part-way up the learnig curve on this one.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions or pointers would be appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 01:44:54 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1905615#M36497</guid>
      <dc:creator>BetterVIEW</dc:creator>
      <dc:date>2012-03-08T01:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Foreign Key constraints with Database Connectivity Toolkit</title>
      <link>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1905625#M36498</link>
      <description>&lt;P&gt;Oops, it looks like I posted this to the wrong board. -- Sorry about that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Still, if anyone has some ideas...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 01:53:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1905625#M36498</guid>
      <dc:creator>BetterVIEW</dc:creator>
      <dc:date>2012-03-08T01:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Foreign Key constraints with Database Connectivity Toolkit</title>
      <link>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1907367#M36522</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a look at this document:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://digital.ni.com/public.nsf/allkb/9212B594E5F9A7A786256C100061D516?OpenDocument" target="_blank"&gt;http://digital.ni.com/public.nsf/allkb/9212B594E5F9A7A786256C100061D516?OpenDocument&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greg H.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 22:48:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/NI-TestStand/Setting-Foreign-Key-constraints-with-Database-Connectivity/m-p/1907367#M36522</guid>
      <dc:creator>Greg-H</dc:creator>
      <dc:date>2012-03-08T22:48:33Z</dc:date>
    </item>
  </channel>
</rss>

