<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.modelright.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Scripts</title><link>http://www.modelright.com/files/folders/scripts/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 (Build: 60809.935)</generator><item><title>Change the Referenced Object Owner of Synonyms</title><link>http://www.modelright.com/files/folders/scripts/entry923.aspx</link><pubDate>Tue, 30 Sep 2008 13:36:14 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:923</guid><dc:creator>ricktg</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This script changes the Referenced Owner/Schema of Synonyms. This Schema does not need to be created on MR.&lt;/p&gt;&lt;p&gt;To change this, you only need to specify which owner you want to change and what is the new owner name. Just look at the code and you&amp;#39;ll see where to input that. &lt;/p&gt;&lt;p&gt;Here&amp;#39;s an example:&lt;/p&gt;&lt;p&gt;I have this Synonym: create or replace synonym Schema001.SYN_TBL_TEST for Schema002.TBL_TEST;&lt;/p&gt;&lt;p&gt;Now, i want to change the Schema002 name. So i change the following lines:&lt;/p&gt;&lt;p&gt;&amp;nbsp; fromUser = &amp;quot;Schema002&amp;quot;&lt;br /&gt;&amp;nbsp; toUser = &amp;quot;NewSchema003&amp;quot; &lt;/p&gt;&lt;p&gt;Then i run it. Done! The synonym will be like this:&lt;/p&gt;&lt;p&gt;&amp;nbsp;create or replace synonym Schema001.SYN_TBL_TEST for NewSchema003.TBL_TEST;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Att,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Ricardo&amp;nbsp;&lt;img src="http://www.modelright.com/emoticons/emotion-21.gif" alt="Yes" /&gt;&lt;br /&gt;&lt;/p&gt;</description><enclosure url="http://www.ricktg.com/MRFiles/ChangeOwnerRef.vbs" length="1316" type="text/plain" /></item><item><title>How to export ModelRight info to Excel</title><link>http://www.modelright.com/files/folders/scripts/entry658.aspx</link><pubDate>Tue, 17 Jun 2008 13:42:26 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:658</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Here&amp;#39;s a simple example of how to export ModelRight Model info to Excel.&amp;nbsp; Add a user-defined script object and copy/paste the following into it.&amp;nbsp; Then run it:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Sub Evaluate_OnLoad()&lt;br /&gt;&amp;nbsp;Set Context = CreateObject(&amp;quot;SCF.ScriptContext&amp;quot;)&lt;br /&gt;&amp;nbsp;Set ThisScript = Context.Object&lt;br /&gt;&amp;nbsp;Set Options = Context.Options&lt;br /&gt;&amp;nbsp;Set Model = ThisScript.Model&lt;/p&gt;&lt;p&gt;&amp;nbsp;Dim NumRows, x1, col&lt;br /&gt;&amp;nbsp;NumRows = 2&lt;br /&gt;&amp;nbsp;Set ExcelDoc = CreateObject(&amp;quot;Excel.Application&amp;quot;)&lt;br /&gt;&amp;nbsp;ExcelDoc.Visible = true &lt;br /&gt;&amp;nbsp;ExcelDoc.Workbooks.Add&lt;br /&gt;&amp;nbsp;ExcelDoc.Range(&amp;quot;A1&amp;quot;).Value = &amp;quot;Table&amp;quot;&lt;br /&gt;&amp;nbsp;ExcelDoc.Range(&amp;quot;B1&amp;quot;).Value = &amp;quot;Column&amp;quot;&lt;br /&gt;&amp;nbsp;ExcelDoc.Range(&amp;quot;C1&amp;quot;).Value = &amp;quot;Datatype&amp;quot;&lt;br /&gt;&amp;nbsp;Set Tables = Model.AsObject.Children(&amp;quot;Table&amp;quot;)&lt;br /&gt;&amp;nbsp;For Each Table In Tables&lt;br /&gt;&amp;nbsp;&amp;nbsp;TableName = Table.Property(&amp;quot;Name&amp;quot;).AsString&lt;br /&gt;&amp;nbsp;&amp;nbsp;Set Columns = Table.Children(&amp;quot;Column&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;For Each Column in Columns&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExcelDoc.Range(&amp;quot;A&amp;quot; + Cstr(NumRows)).Value = TableName&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExcelDoc.Range(&amp;quot;B&amp;quot; + Cstr(NumRows)).Value = Column.Property(&amp;quot;Name&amp;quot;).AsString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExcelDoc.Range(&amp;quot;C&amp;quot; + Cstr(NumRows)).Value = Column.Property(&amp;quot;Datatype&amp;quot;).AsString&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;NumRows = NumRows + 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;Next&lt;br /&gt;&amp;nbsp;Next&lt;/p&gt;&lt;p&gt;&amp;nbsp;ExcelDoc.Columns(&amp;quot;A:C&amp;quot;).EntireColumn.AutoFit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;ExcelDoc.Rows(&amp;quot;1:&amp;quot; + cstr(NumRows)).EntireRow.AutoFit &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;End Sub&lt;/p&gt;</description><enclosure url="http://www.modelright.com/files/folders/658/download.aspx" length="1041" type="text/plain" /></item><item><title>GenerateIndexes</title><link>http://www.modelright.com/files/folders/scripts/entry634.aspx</link><pubDate>Tue, 06 May 2008 20:38:41 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:634</guid><dc:creator>modelright</dc:creator><slash:comments>0</slash:comments><description>&lt;span style="font-size:10pt;font-family:Arial;"&gt;This is a script that generates the SQL&amp;nbsp;DDL for all indexes. It is useful if one wants to&amp;nbsp;generate&amp;nbsp;the SQL of all indexes separated from the SQL of tables.&lt;/span&gt;</description><enclosure url="http://www.modelright.com/files/folders/634/download.aspx" length="486" type="application/octet-stream" /></item><item><title>GenerateConstraints</title><link>http://www.modelright.com/files/folders/scripts/entry633.aspx</link><pubDate>Tue, 06 May 2008 20:38:09 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:633</guid><dc:creator>modelright</dc:creator><slash:comments>0</slash:comments><description>&lt;span style="font-size:10pt;font-family:Arial;"&gt;This is a script that generates the SQL&amp;nbsp;DDL for all constraints (Primary, Unique&amp;nbsp;and&amp;nbsp;Foreign Keys). It is useful if one wants to&amp;nbsp;generate&amp;nbsp;the SQL of all key constraints separated from the SQL of tables.&lt;/span&gt;</description><enclosure url="http://www.modelright.com/files/folders/633/download.aspx" length="730" type="application/octet-stream" /></item><item><title>create a synonym in a "To Schema" for each Table in the "From Schema"</title><link>http://www.modelright.com/files/folders/scripts/entry553.aspx</link><pubDate>Mon, 31 Mar 2008 21:03:13 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:553</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;font size="3"&gt;&lt;font size="2"&gt;This script will create a synonym in a &amp;quot;To Schema&amp;quot;&amp;nbsp;for each Table in the &amp;quot;From Schema&amp;quot; (if it doesnt already exist).&amp;nbsp; You should edit the FromSchemaName and ToSchemaName before running the script.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;To run it:&lt;br /&gt;&lt;br /&gt;1) bring up the Script Explorer&lt;/p&gt;&lt;p&gt;2) right click on &amp;quot;User Defined&amp;quot; and select &amp;quot;New Script&amp;quot;&lt;/p&gt;&lt;p&gt;3) copy/paste the attachment into the edit control&lt;/p&gt;&lt;p&gt;4) hit the run button (the first icon in the toolbar above the edit control)&lt;/p&gt;&lt;p&gt;Note: you can undo/redo the effects of this script as with any Model changes&lt;br /&gt;&lt;/p&gt;</description><enclosure url="http://www.modelright.com/files/folders/553/download.aspx" length="3516" type="text/plain" /></item><item><title>Creates FK indexes and deletes redundant indexes</title><link>http://www.modelright.com/files/folders/scripts/entry515.aspx</link><pubDate>Fri, 14 Mar 2008 04:07:08 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:515</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This script is for Oracle, but could easily be adapted for other databases.&lt;/p&gt;&lt;p&gt;It iterates over all tables and creates an FK index if one doesnt already exist and if it wouldnt be redundant.&lt;/p&gt;&lt;p&gt;It also deletes any indexes that are redundant - ie. covered by another index.&lt;/p&gt;&lt;p&gt;It has a couple variables at the beginning of the Evaluate_OnLoad&amp;nbsp;sub&amp;nbsp;that you can set:&lt;/p&gt;&lt;p&gt;DeleteIfPrefixMatches - set to true if you want the index deleted if it matches the prefix of another index.&amp;nbsp; Otherwise, it needs to match the entire index.&lt;/p&gt;&lt;p&gt;WarnOnly - dont actually delete or create any indexes, just output what it would do.&amp;nbsp; Of course, even if you do delete indexes, you can always undo the delete.&lt;/p&gt;</description><enclosure url="http://www.modelright.com/files/folders/515/download.aspx" length="6307" type="text/plain" /></item><item><title>creates join indexes for all relations</title><link>http://www.modelright.com/files/folders/scripts/entry430.aspx</link><pubDate>Thu, 14 Feb 2008 14:48:00 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:430</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This script will i&lt;font size="3"&gt;terate over all the tables in your model and all of their relations&amp;nbsp;and create an FK/join index for the relation&amp;nbsp;if one doesnt already exist.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Only makes sense for databases like Oracle that don&amp;#39;t auto create FK/Join indexes.&amp;nbsp; For databases that do, ModelRight auto-creates them as well.&lt;/p&gt;&lt;p&gt;&amp;nbsp;To run it:&lt;br /&gt;&lt;br /&gt;1) bring up the Script Explorer&lt;/p&gt;&lt;p&gt;2) right click on &amp;quot;User Defined&amp;quot; and select &amp;quot;New Script&amp;quot;&lt;/p&gt;&lt;p&gt;3) copy/paste the attachment into the edit control&lt;/p&gt;&lt;p&gt;4) hit the run button (the first icon in the toolbar above the edit control)&lt;/p&gt;&lt;p&gt;Note: you can undo/redo the effects of this script as with any Model changes&lt;br /&gt;&lt;/p&gt;</description><enclosure url="http://www.modelright.com/files/folders/430/download.aspx" length="1655" type="text/plain" /></item><item><title>Copy Table positions from one Diagram to another</title><link>http://www.modelright.com/files/folders/scripts/entry344.aspx</link><pubDate>Fri, 11 Jan 2008 14:28:44 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:344</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This script will copy Table and View positions from one Diagram to another.&amp;nbsp; You can specify a From and To Diagram that you want to use:&lt;/p&gt;&lt;p&gt;&amp;nbsp;To run it:&lt;br /&gt;&lt;br /&gt;1) bring up the Script Explorer&lt;/p&gt;&lt;p&gt;2) right click on &amp;quot;User Defined&amp;quot; and select &amp;quot;New Script&amp;quot;&lt;/p&gt;&lt;p&gt;3) copy/paste the attachment into the edit control&lt;/p&gt;&lt;p&gt;4) change the FromModelSubsetName, FromDiagramName, ToModelSubsetName, and ToDiagramName&amp;nbsp; in the Evaluate_OnLoad&amp;nbsp;subroutine&amp;nbsp;to match the names of the Model Subsets and Diagrams that you want to use.&lt;/p&gt;&lt;p&gt;5) hit the run button (the first icon in the toolbar above the edit control)&lt;/p&gt;&lt;p&gt;Note: you can undo/redo the effects of this script as with any Model changes&lt;br /&gt;&lt;/p&gt;</description><enclosure url="http://www.modelright.com/files/folders/344/download.aspx" length="3416" type="text/plain" /></item><item><title>Rename Contraint Names</title><link>http://www.modelright.com/files/folders/scripts/entry110.aspx</link><pubDate>Wed, 17 Oct 2007 23:57:55 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:110</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>Similar to Update Constraint Names, but this changes key constraint, fk constraint, check constraint, lob storage names regardless of whether they are still using their default names.&amp;nbsp; It tries not to rename them subsequently though.</description><enclosure url="http://www.modelright.com/files/folders/110/download.aspx" length="5654" type="text/plain" /></item><item><title>Auto Rename Migrating Column to Prefix with Parent Table Name</title><link>http://www.modelright.com/files/folders/scripts/entry102.aspx</link><pubDate>Thu, 11 Oct 2007 19:58:57 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:102</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><description>&lt;div class="ForumPostContentText" id="ctl00_ctl01_bcr_ctl00___PostRepeater_ctl01_PostViewWrapper"&gt;&lt;p&gt;As of Build 2020, ModelRight&amp;nbsp;has the ability to rename a migrating column as it migrates.&lt;/p&gt;&lt;p&gt;For example, you could&amp;nbsp;prefix a migrating column with the parent table name.&amp;nbsp; We did this via a script that gets evaluated and returns a name for the migrating column.&amp;nbsp; This approach is more general than just being able to prefix with something specific - like the parent table name.&amp;nbsp; &lt;/p&gt;&lt;p&gt;To use it go to the Script Explorer (probably a tab for it next to Model Explorer), expand to &amp;lt;database&amp;gt;/Relation/Auto Rename Migrating Column.&amp;nbsp; Enter the following text for the script in the property browser (this will prefix the migrating column with the parent table name):&lt;/p&gt;&lt;p&gt;&amp;#39;&amp;nbsp; Auto Rename Migrating Column Script&lt;br /&gt;Sub Evaluate_OnLoad()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Context&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set Context = CreateObject(&amp;quot;SCF.ScriptContext&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Document&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set Document = Context.ScriptDocument&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim MigratingColumn&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set MigratingColumn = Context.MigratingColumn&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim MigratingRelation&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set MigratingRelation = Context.MigratingRelation&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ParentTable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set ParentTable = MigratingRelation.Property(&amp;quot;Parent Table&amp;quot;).AsObject&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document.Write(ParentTable.Property(&amp;quot;Name&amp;quot;).AsString &amp;amp; &amp;quot;_&amp;quot; &amp;amp; MigratingColumn.Property(&amp;quot;Name&amp;quot;).AsString)&lt;br /&gt;End Sub&lt;/p&gt;&lt;p&gt;If you want all of your models to use this, then right click on the script in the script explorer and select Save to Disk.&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</description><enclosure url="http://www.modelright.com/files/folders/102/download.aspx" length="589" type="text/plain" /></item><item><title>Update Constraint Names Script</title><link>http://www.modelright.com/files/folders/scripts/entry74.aspx</link><pubDate>Fri, 16 Mar 2007 18:23:14 GMT</pubDate><guid isPermaLink="false">af228657-1c3f-4806-827c-b201ff29f2c4:74</guid><dc:creator>admin</dc:creator><slash:comments>1</slash:comments><description>This script will go through all the tables in the model and update key constraints and relations that are still using a default name.&amp;nbsp; Place the script in a sub-folder to the MR install/exe called Scripts\User Defined and it will appear in the Scripts Explorer tab under User Defined scripts.&amp;nbsp; Select the script in the explorer and then click the run button in the Property Browser.</description><enclosure url="http://www.modelright.com/files/folders/74/download.aspx" length="2014" type="application/octet-stream" /></item></channel></rss>