<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.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>John Paul Cook : Tips and Tricks</title><link>http://sqlblog.com/blogs/john_paul_cook/archive/tags/Tips+and+Tricks/default.aspx</link><description>Tags: Tips and Tricks</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>SSMS Tips and Tricks: Scripting Inserts</title><link>http://sqlblog.com/blogs/john_paul_cook/archive/2009/10/13/ssms-tips-and-tricks-scripting-inserts.aspx</link><pubDate>Wed, 14 Oct 2009 02:03:25 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:17726</guid><dc:creator>John Paul Cook</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/john_paul_cook/comments/17726.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/john_paul_cook/commentrss.aspx?PostID=17726</wfw:commentRss><description>Sometimes you need to be able to script the loading of a table. SSIS and the Import/Export Wizard can do this, but there are times when you really need a complete set of insert statements. Red Gate’s SQL Data Compare or SQL Packager can do this, but not...(&lt;a href="http://sqlblog.com/blogs/john_paul_cook/archive/2009/10/13/ssms-tips-and-tricks-scripting-inserts.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=17726" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/john_paul_cook/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://sqlblog.com/blogs/john_paul_cook/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category></item><item><title>Disaster Recovery for Your Windows Mobile Phone</title><link>http://sqlblog.com/blogs/john_paul_cook/archive/2009/04/12/disaster-recovery-for-your-windows-mobile-phone.aspx</link><pubDate>Mon, 13 Apr 2009 02:18:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:13257</guid><dc:creator>John Paul Cook</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/john_paul_cook/comments/13257.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/john_paul_cook/commentrss.aspx?PostID=13257</wfw:commentRss><description>&lt;P&gt;Right after doing a hard reset of my Windows Mobile phone, I realized that my phone’s contacts hadn’t been backed up. Now that’s a disaster! I had Kalen Delaney’s and Paul Nielsen’s cell phone numbers on my cell phone – not something to lose. From the MVP newsgroup for Windows Mobile devices, I found out about the beta version of Microsoft MyPhone. It’s a limited beta and it took a few days before my application was accepted. After installing MyPhone on my phone, I used MyPhone’s sync feature to backup my data to the cloud. I can now resync my Windows Mobile phone from the web. Even if I lose or damage my phone, I could sync a new phone from the MyPhone website and be back in business quickly.&lt;/P&gt;
&lt;P&gt;Speaking of damaging a phone, have you ever wondered what to do with a phone that gets wet? Assuming you drop your phone into relatively clean fresh water, one of my neighbors has a repair technique that has served her very well more than once. She boils the water out. Think back to your physics class. Boiling doesn’t have to mean hot. Lower the atmospheric pressure and the boiling point temperature is depressed. My neighbor rushes her wet electronic devices over to her father’s house. He puts the phone or other device in a bell jar and uses a vacuum pump to reduce the pressure until water is boiling at room temperature. After a short period of time, all of the water in the phone is boiled away.&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=13257" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/john_paul_cook/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category></item><item><title>Finding Tables Without Referential Integrity</title><link>http://sqlblog.com/blogs/john_paul_cook/archive/2009/04/08/finding-tables-without-referential-integrity.aspx</link><pubDate>Wed, 08 Apr 2009 17:38:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:13162</guid><dc:creator>John Paul Cook</dc:creator><slash:comments>10</slash:comments><comments>http://sqlblog.com/blogs/john_paul_cook/comments/13162.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/john_paul_cook/commentrss.aspx?PostID=13162</wfw:commentRss><description>&lt;P&gt;Following up on yesterday's post from Louis, sometimes you encounter databases with missing referential integrity constraints. Even when the database is intended to have RI, accidents happen. Maybe a script dropped RI constraints before a bulk load and didn't quite get all of the constraints recreated. Whatever the reason, it's good to have a script to identify tables that are not referenced and do not reference other tables. Here's a script that works on SQL Server 2005 and 2008 (updated to no longer use sysreferences as per Adam Machanic's suggestion):&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;SELECT&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;objects&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;name&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;FROM&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;objects&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;LEFT&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;JOIN&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;foreign_keys&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; referenced&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ON&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;objects&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;object_id&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; referenced&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;referenced_object_id &lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;LEFT&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;JOIN&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;foreign_keys&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; parent&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ON&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;objects&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;object_id&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; parent&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;parent_object_id&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;WHERE&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;objects&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;type&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;'U'&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;AND&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; referenced&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;referenced_object_id &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;IS&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;NULL&lt;BR&gt;AND&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; parent&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;parent_object_id &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;IS&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;NULL&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;Louis did a good job explaining the importance of using the database engine to protect the integrity of the data. As a consultant, I've seen lots of databases with varying degrees of referential integrity. It never works out well in the long run when referential integrity isn't enforced in the database. Application code - even if it is christened object relational mapping - is no substitute for imposing referential integrity checks in the database. A relational database is more than a data storage repository - and it should be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=13162" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/john_paul_cook/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category></item><item><title>Keep Your Server Clean by Using Virtual Applications</title><link>http://sqlblog.com/blogs/john_paul_cook/archive/2008/01/30/keep-your-server-clean-by-using-virtual-applications.aspx</link><pubDate>Thu, 31 Jan 2008 03:37:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:4786</guid><dc:creator>John Paul Cook</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/john_paul_cook/comments/4786.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/john_paul_cook/commentrss.aspx?PostID=4786</wfw:commentRss><description>&lt;P&gt;It's pretty well understood that it's highly desirable to keep servers lean and mean. But what do you do when you need to use a tool, particularly if it is needed only once? You could install the utility application and then remove it, but that does introduce risk. Virtual applications provide the answer. You can actually run an application without installing it.&lt;/P&gt;
&lt;P&gt;There are two basic classes of virtual applications: agentless and those that require an agent. &lt;A class="" title="Microsoft Application Virtualization" href="http://www.microsoft.com/systemcenter/softgrid/default.mspx"&gt;Microsoft Application Virtualization&lt;/A&gt; (formerly SoftGrid) and &lt;A class="" title="Altiris SVS" href="http://www.altiris.com/Products/SoftwareVirtualizationSolution.aspx"&gt;Altiris Software Virtualization Solution&lt;/A&gt; are well known examples of application virtualization that use an agent. In order for the virtualized applications to work, an agent must be installed on the machine. The agent provides a boundary, a sandbox, in which the application runs without interfering with what's installed on the machine. Agentless virtualized application solutions create a single, self-contained executable that runs without being installed and without elevated permissions. The application is isolated from the host it is running on and doesn't interfere. Examples of agentless virtualized application products are &lt;A class="" title="Xenocode Application Virtualization" href="http://sqlblog.com/controlpanel/blogs/www.xenocode.com"&gt;Xenocode&lt;/A&gt; and VMware's &lt;A class="" title="Thinstall Application Virtualization" href="http://sqlblog.com/controlpanel/blogs/www.thinstall.com"&gt;Thinstall&lt;/A&gt;. &lt;A class="" title="Trigence Application Virtualization" href="http://sqlblog.com/controlpanel/blogs/www.trigence.com"&gt;Trigence&lt;/A&gt; offers agentless application virtualization, but they haven't made it possible for me to evaluate it.&lt;/P&gt;
&lt;P&gt;For a database server, the objective is to change it as little as possible. That's why I prefer agentless solutions. A large assortment of agentless virtualized applications can be downloaded from &lt;A href="http://www.thindownload.com/"&gt;www.thindownload.com&lt;/A&gt;. Another agentless solution worthy of consideration is &lt;A class="" title="Portable Apps" href="http://sqlblog.com/controlpanel/blogs/www.portableapps.com"&gt;Portable Apps&lt;/A&gt;. While technically not fully virtualized applications, the applications that are included with or can be added to Portable Apps run without being installed. This makes the Portable Apps suite a quite useful suite of tools for servers. I copied the Portable Apps suite to&amp;nbsp;a &lt;A class="" title="High Speed USB Memory Stick" href="http://www.corsair.com/products/survivor.aspx"&gt;Corsair high speed USB memory stick&lt;/A&gt;. You can use any USB memory stick, but I did notice a considerable performance improvement for high speed sticks compared to tradeshow freebies. Last week I needed to compute a MD5 hash for a SQL Server installation iso file. I inserted the USB stick and ran &lt;A class="" title="Portable Apps version of winMd5Sum" href="http://portableapps.com/apps/utilities/winmd5sum_portable"&gt;winMd5Sum&lt;/A&gt; without installing it or in any way messing up the server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Virtualized applications are also great for application testing, but that's a story for another day.&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=4786" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/john_paul_cook/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category></item></channel></rss>