<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mohammed Osman &#187; SQL Server</title>
	<atom:link href="http://osman.it/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://osman.it</link>
	<description></description>
	<lastBuildDate>Mon, 05 Dec 2011 20:05:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>SQL Complete – free SQL autocomplete tool</title>
		<link>http://osman.it/sql-server/sql-complete-%e2%80%93-free-sql-autocomplete-tool/</link>
		<comments>http://osman.it/sql-server/sql-complete-%e2%80%93-free-sql-autocomplete-tool/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 16:00:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Complete – free SQL autocomplete tool]]></category>

		<guid isPermaLink="false">http://osman.it/?p=563</guid>
		<description><![CDATA[SQL Complete – free SQL autocomplete tool dbForge SQL Complete is a free add-in for Microsoft SQL Server Management Studio (SSMS) that replaces built-in IntelliSense® with more powerful autocomplete features to speed up typing of T-SQL queries and brings more comfort as well as productivity to your work. Besides extending List Members, Complete Word and [...]]]></description>
			<content:encoded><![CDATA[<h1>SQL Complete – free SQL autocomplete tool</h1>
<p>dbForge SQL Complete is a <strong>free</strong> add-in for Microsoft SQL Server Management Studio (SSMS) that replaces built-in IntelliSense® with more powerful autocomplete features to speed up typing of T-SQL queries and brings more comfort as well as productivity to your work.</p>
<p>Besides extending List Members, Complete Word and Parameter Info features, SQL Complete adds SQL Formatter to enrich the developer toolkit and provide the fastest T-SQL query typing ever possible.</p>
<h3>What does it mean for you?</h3>
<p><strong>List Members</strong></p>
<p>You do not have to remember the names of objects in your database. When typing SQL statements, you will see a list of objects from the selected database or schema, names of table columns, and even keywords matching the context.</p>
<p><strong>Complete Word</strong></p>
<p>Instead of typing the whole database object name, you can just type first several characters. If SQL Complete finds only one match, it automatically inserts it to complete the word.</p>
<p><strong>Parameter Info</strong></p>
<p>When calling any built-in or user-defined function in your query, you can see a hint with information about the function and parameters it requires.</p>
<p><strong>SQL Formatter</strong></p>
<p>You can effortlessly get all your SQL code formatted based on one or another style. It takes only to set required rules by using a wide selection of formatting options. SQL Complete automatically formats SQL statements paying attention to case, line breaks, whitespaces, indenting, wrapping, etc.</p>
<h3>Why is SQL Complete better than SSMS native IntelliSense®?</h3>
<p>One of the main reasons to choose SQL Complete is that it provides Intellisense for SQL Server 2000, 2005, 2008, regardless of SSMS versions. Native intellisense does not work with those SQL Server versions that differ from your SMSS version. For example, SQL Server Management Studio 2008 will work with SQL Server 2008 only.</p>
<p>Is this not enough? Or are you still asking a reasonable question, &#8220;Why should I need a third-party tool besides the standard intellisense functionality?&#8221; Look at the <a href="http://www.devart.com/dbforge/sql/sqlcomplete/featurecomparison.html">feature comparison matrix</a> and decide.</p>
<h2>Key Features</h2>
<ul>
<li>Context-based SQL code completion <a href="http://www.devart.com/dbforge/sql/sqlcomplete/features.html">(view)</a></li>
<li>Smart filtering to suggest relative keywords and objects <a href="http://www.devart.com/dbforge/sql/sqlcomplete/features.html">(view)</a></li>
<li>Quick parameter info for functions and procedures <a href="http://www.devart.com/dbforge/sql/sqlcomplete/features.html">(view)</a></li>
<li>Customizable SQL formatting <a href="http://www.devart.com/dbforge/sql/sqlcomplete/features.html">(view)</a></li>
<li>Support of SQL Server 2000, 2005 and 2008</li>
<li><a href="http://www.devart.com/dbforge/sql/sqlcomplete/features.html">More features</a></li>
</ul>
<img src="http://osman.it/?ak_action=api_record_view&id=563&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fsql-complete-%25e2%2580%2593-free-sql-autocomplete-tool%2F&amp;title=SQL%20Complete%20%E2%80%93%20free%20SQL%20autocomplete%20tool" id="wpa2a_2"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2011. |
<a href="http://osman.it/sql-server/sql-complete-%e2%80%93-free-sql-autocomplete-tool/">Permalink</a> |
<a href="http://osman.it/sql-server/sql-complete-%e2%80%93-free-sql-autocomplete-tool/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/sql-complete-%e2%80%93-free-sql-autocomplete-tool/&title=SQL Complete – free SQL autocomplete tool">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/sql-complete-%e2%80%93-free-sql-autocomplete-tool/" rel="tag">SQL Complete – free SQL autocomplete tool</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/sql-complete-%e2%80%93-free-sql-autocomplete-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s new in SQL Server 2008 for SSIS &#8211; Part one</title>
		<link>http://osman.it/sql-server/whats-new-in-sql-server-2008-for-ssis-part-one/</link>
		<comments>http://osman.it/sql-server/whats-new-in-sql-server-2008-for-ssis-part-one/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 22:03:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[What's new in SQL Server 2008 for SSIS]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=215</guid>
		<description><![CDATA[Improved Scripting SQL Server 2008 (Katmai) introduces VSTA as our new scripting engine, which replaces the old VSA engine used in SQL Server 2005 (Yukon). There are a number of advantages to the new engine, but I think the feature users are most excited about is that it allows you to use C# as a [...]]]></description>
			<content:encoded><![CDATA[<p>Improved Scripting</p>
<p>SQL Server 2008 (Katmai) introduces VSTA as our new scripting engine, which <a href="http://blogs.msdn.com/vsta/archive/2006/02/03/524676.aspx">replaces the old VSA engine</a> used in SQL Server 2005 (Yukon). There are a number of advantages to the new engine, but I think the feature users are most excited about is that it allows you to use C# as a scripting language (as well as VB.NET). It also makes it easier to reference all .Net assemblies, which enables a number of common scenarios (such as easier web service integration).</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_6.png"><img height="190" alt="image" width="244" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_2.png" /></a></p>
<h3>Data Flow Task Improvements</h3>
<p>Michael Entin provided a great write-up for the <a href="http://blogs.msdn.com/michen/archive/2007/06/11/katmai-ssis-data-flow-improvements.aspx">enhancements to our data flow engine</a>. It essentially boils down to smarter thread allocation and processing of our execution trees. Long chains of synchronous transforms are optimized, and most packages will see a performance increase on multi-processor machines.</p>
<p>One CPU usage graph I really like is the one shown at PASS this year:</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_8.png"><img height="55" alt="Yukon CPU graph" width="244" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_3.png" /></a></p>
<p>This shows Yukon package execution on a quad CPU machine. You can see CPU #4 is used steadily, while two others spike occasionally. It also looks like usage goes down on #2 when it goes up on #3, and vice versa.</p>
<p>Running the same package using the Katmai engine looks like this:</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_10.png"><img height="56" alt="Katmai CPU graph" width="244" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_4.png" /></a></p>
<p>This graph shows much better CPU usage distribution. In this case, the package received an 80% performance increase, but your mileage may vary.</p>
<h3>Enhanced ADO.Net Support</h3>
<p>Katmai now has an ADO.Net source (replacing the DataReader source) and destination adapters. They function a lot like the OLEDB ones, supporting a custom UI, drop down list of tables/views, and query builder. Its properties are also expression-able. This means we now support ODBC as a destination, as well.</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_12.png"><img height="195" alt="image" width="244" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_5.png" /></a></p>
<h3>Import/Export Wizard</h3>
<p>The SQL Server Import/Export Wizard (which generates SSIS packages) has been improved as well.</p>
<ul>
<li>ADO.Net support (which gives you ODBC)</li>
<li>Data type conversion &#8211; mappings are read from customizable (xml) files, and data convert transforms will be inserted into the data flow if required</li>
<li>Scales better &#8211; large numbers of tables will be split across multiple data flows (up to five sources per data flow)</li>
</ul>
<p>Here is an example of the data conversion page:</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_14.png"><img height="244" alt="Import/Export Wizard data conversion mapping" width="233" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_6.png" /></a>&nbsp;</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_16.png"><img height="244" alt="image" width="166" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_7.png" /></a></p>
<h3>Cached Lookup</h3>
<p>As I mentioned in an <a href="http://blogs.msdn.com/mattm/archive/2008/01/08/no-more-implicit-lookup-cache-sharing-in-katmai.aspx">earlier post</a>, Jamie Thompson provided a very good <a href="http://blogs.conchango.com/jamiethomson/archive/2007/11/16/Katmai_3A00_-SSIS_3A00_-Lookup-component-gets-a-makeover.aspx">write up</a> of the new lookup component. The main feature is that you can now create a lookup cache in a separate data flow using the new Lookup Cache Transform and Cache Connection Manager, and persist it to disk. This cache can be created from any data source supported by SSIS, which removes the need to stage your lookup table in a database.</p>
<p>This persisted cache is especially useful in scenarios where reference data is updated periodically &#8211; say, once a week. You can run a package to generate your cache when the update comes in, and re-use it in the rest of your packages until it needs to be updated again.</p>
<p>Another scenario is managing large lookup tables, where a small number of keys are used a large percentage of the time. For example, 5% of your customer IDs show up in 80% of your rows. Instead of caching the entire lookup table, you can use a cached lookup for the top 5%, and cascade another lookup in partial / no-cache mode for the infrequent rows.</p>
<p><a href="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_18.png"><img height="244" alt="image" width="210" border="0" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/blogfiles/mattm/WindowsLiveWriter/WhatsnewinSQLServer2008forSSIS_DF83/image_thumb_8.png" /></a></p>
<p>As you can see from the screen shot, Lookup also has a new &quot;No Match&quot; output &#8211; rows with no matches aren&#8217;t directly sent to the error output anymore. We also maintain a &quot;Miss Cache&quot; internally, so missing keys aren&#8217;t constantly re-queried.</p>
<p><a href="http://blogs.msdn.com/mattm/archive/2008/01/10/what-s-new-in-sql-server-2008-for-ssis-part-one.aspx">http://blogs.msdn.com/mattm/archive/2008/01/10/what-s-new-in-sql-server-2008-for-ssis-part-one.aspx</a></p>
<img src="http://osman.it/?ak_action=api_record_view&id=215&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fwhats-new-in-sql-server-2008-for-ssis-part-one%2F&amp;title=What%26%238217%3Bs%20new%20in%20SQL%20Server%202008%20for%20SSIS%20%26%238211%3B%20Part%20one" id="wpa2a_4"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/whats-new-in-sql-server-2008-for-ssis-part-one/">Permalink</a> |
<a href="http://osman.it/sql-server/whats-new-in-sql-server-2008-for-ssis-part-one/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/whats-new-in-sql-server-2008-for-ssis-part-one/&title=What&#8217;s new in SQL Server 2008 for SSIS &#8211; Part one">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/whats-new-in-sql-server-2008-for-ssis/" rel="tag">What's new in SQL Server 2008 for SSIS</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/whats-new-in-sql-server-2008-for-ssis-part-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escaping In SSIS Expressions</title>
		<link>http://osman.it/sql-server/escaping-in-ssis-expressions/</link>
		<comments>http://osman.it/sql-server/escaping-in-ssis-expressions/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 21:54:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Escaping In SSIS Expressions]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=212</guid>
		<description><![CDATA[The expressions language is a C style syntax, so you may need to escape certain characters, for example: &#34;C:\FolderPath\&#34; + @FileName Should be &#34;C:\\FolderPath\\&#34; + @FileName Another use of the escape sequence allows you to specify character codes, like this \xNNNN, where NNNN is the Unicode character code that you want. For example the following [...]]]></description>
			<content:encoded><![CDATA[<div class="text">
<p>The expressions language is a C style syntax, so you may need to escape certain characters, for example:</p>
<p>&quot;C:\FolderPath\&quot; + @FileName</p>
<p>Should be <br />
&quot;C:\\FolderPath\\&quot; + @FileName</p>
<p>Another use of the escape sequence allows you to specify character codes, like this \xNNNN, where NNNN is the Unicode character code that you want. For example the following expression will produce the same result as the previous example as the Unicode character code 005C equals a back slash character:</p>
<p>&quot;C:\x005CFolderPath\x005C&quot; + @FileName</p>
<p>For more information about Unicode characters see <a href="http://www.unicode.org/charts/">http://www.unicode.org/charts/</a></p>
<p>Literals are also supported within expressions, both string literals using the common escape sequence syntax as well as modifiers which influence the handling of numeric values. See the &quot;Literals (SSIS)&quot;:<a href="http://msdn2.microsoft.com/en-US/library/ms141001(SQL.90).aspx">http://msdn2.microsoft.com/en-US/library/ms141001(SQL.90).aspx</a> topic.</p>
<p>Using the Unicode escaped character sequence you can make up for the lack of a CHAR function or equivalent.</p>
</div>
<img src="http://osman.it/?ak_action=api_record_view&id=212&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fescaping-in-ssis-expressions%2F&amp;title=Escaping%20In%20SSIS%20Expressions" id="wpa2a_6"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/escaping-in-ssis-expressions/">Permalink</a> |
<a href="http://osman.it/sql-server/escaping-in-ssis-expressions/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/escaping-in-ssis-expressions/&title=Escaping In SSIS Expressions">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/escaping-in-ssis-expressions/" rel="tag">Escaping In SSIS Expressions</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/escaping-in-ssis-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lock Down SQL Server 2005</title>
		<link>http://osman.it/sql-server/lock-down-sql-server-2005/</link>
		<comments>http://osman.it/sql-server/lock-down-sql-server-2005/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 15:08:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Lock Down SQL Server 2005]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=183</guid>
		<description><![CDATA[&#160; -- Revoke EXECUTE permissions from public on all extended stored procedures. These procedures -- aid attackers in compromising your server and network. USE master &#160; DECLARE DangerousStoredProcedures CURSOR STATIC READ_ONLY FOR SELECT name FROM sys.all_objects WHERE TYPE = 'X' OR &#40;TYPE = 'P' AND name LIKE 'xp%'&#41; &#160; DECLARE @SpName sysname, @FullCommand nvarchar&#40;4000&#41; &#160; [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;">-- Revoke EXECUTE permissions from public on all extended stored procedures. These procedures</span>
<span style="color: #808080; font-style: italic;">-- aid attackers in compromising your server and network.</span>
<span style="color: #993333; font-weight: bold;">USE</span> master
&nbsp;
<span style="color: #993333; font-weight: bold;">DECLARE</span> DangerousStoredProcedures CURSOR STATIC READ_ONLY <span style="color: #993333; font-weight: bold;">FOR</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> name
<span style="color: #993333; font-weight: bold;">FROM</span> sys<span style="color: #66cc66;">.</span>all_objects
<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #993333; font-weight: bold;">TYPE</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'X'</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">TYPE</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'P'</span> <span style="color: #993333; font-weight: bold;">AND</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'xp%'</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">DECLARE</span>
@SpName sysname<span style="color: #66cc66;">,</span>
@FullCommand nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">OPEN</span> DangerousStoredProcedures
FETCH <span style="color: #993333; font-weight: bold;">NEXT</span> <span style="color: #993333; font-weight: bold;">FROM</span> DangerousStoredProcedures <span style="color: #993333; font-weight: bold;">INTO</span> @SpName
&nbsp;
WHILE <span style="color: #66cc66;">&#40;</span>@@FETCH_STATUS <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">BEGIN</span>
<span style="color: #993333; font-weight: bold;">SET</span> @FullCommand <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'REVOKE EXECUTE ON ['</span> <span style="color: #66cc66;">+</span> @SpName <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'] FROM public'</span>
<span style="color: #993333; font-weight: bold;">EXEC</span> sp_executesql @FullCommand
&nbsp;
FETCH <span style="color: #993333; font-weight: bold;">NEXT</span> <span style="color: #993333; font-weight: bold;">FROM</span> DangerousStoredProcedures <span style="color: #993333; font-weight: bold;">INTO</span> @SpName
<span style="color: #993333; font-weight: bold;">END</span>
&nbsp;
DEALLOCATE DangerousStoredProcedures 
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">-- Prevent users from seeing metadata for databases they can't access.</span>
<span style="color: #808080; font-style: italic;">-- Unfortunately users can still enumerate all database names via db_name</span>
<span style="color: #808080; font-style: italic;">-- This makes database enumeration slightly slower, but that's irrelevant in</span>
<span style="color: #808080; font-style: italic;">-- scenarios.</span>
<span style="color: #993333; font-weight: bold;">USE</span> master
<span style="color: #993333; font-weight: bold;">REVOKE</span> <span style="color: #993333; font-weight: bold;">VIEW</span> ANY <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #993333; font-weight: bold;">FROM</span> public
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">-- Don't give msdb access by default. Grant access only to users who need it.</span>
<span style="color: #993333; font-weight: bold;">USE</span> msdb
<span style="color: #993333; font-weight: bold;">REVOKE</span> <span style="color: #993333; font-weight: bold;">CONNECT</span> <span style="color: #993333; font-weight: bold;">TO</span> guest
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">-- View server permissions</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>
	State_Desc<span style="color: #66cc66;">,</span> Permission_Name<span style="color: #66cc66;">,</span> class_desc<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span>OBJECT_NAME<span style="color: #66cc66;">&#40;</span>major_id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>DB_NAME<span style="color: #66cc66;">&#40;</span>major_id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> SecurableName<span style="color: #66cc66;">,</span> SCHEMA_NAME<span style="color: #66cc66;">&#40;</span>O<span style="color: #66cc66;">.</span>schema_id<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#91;</span>Schema<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span>
	Grantees<span style="color: #66cc66;">.</span>Name GranteeName<span style="color: #66cc66;">,</span> Grantees<span style="color: #66cc66;">.</span>Type_Desc GranteeType
<span style="color: #993333; font-weight: bold;">FROM</span> sys<span style="color: #66cc66;">.</span>server_permissions Perms
<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>server_principals Grantees <span style="color: #993333; font-weight: bold;">ON</span> Perms<span style="color: #66cc66;">.</span>Grantee_Principal_Id <span style="color: #66cc66;">=</span> Grantees<span style="color: #66cc66;">.</span>Principal_Id
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">OUTER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>all_objects O <span style="color: #993333; font-weight: bold;">ON</span> Perms<span style="color: #66cc66;">.</span>major_id <span style="color: #66cc66;">=</span> O<span style="color: #66cc66;">.</span>object_id
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> SecurableName
&nbsp;
<span style="color: #808080; font-style: italic;">-- View membership in Server roles</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> Roles<span style="color: #66cc66;">.</span>Name<span style="color: #66cc66;">,</span> Roles<span style="color: #66cc66;">.</span>Type_Desc<span style="color: #66cc66;">,</span> Members<span style="color: #66cc66;">.</span>Name MemberName<span style="color: #66cc66;">,</span> Members<span style="color: #66cc66;">.</span>Type_Desc
<span style="color: #993333; font-weight: bold;">FROM</span> sys<span style="color: #66cc66;">.</span>server_role_members RoleMembers
<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>server_principals Roles <span style="color: #993333; font-weight: bold;">ON</span> Roles<span style="color: #66cc66;">.</span>Principal_Id <span style="color: #66cc66;">=</span> RoleMembers<span style="color: #66cc66;">.</span>Role_Principal_Id
<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>server_principals Members <span style="color: #993333; font-weight: bold;">ON</span> Members<span style="color: #66cc66;">.</span>Principal_Id <span style="color: #66cc66;">=</span> RoleMembers<span style="color: #66cc66;">.</span>Member_Principal_Id
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">-- Keep the vagabonds out, make the  database invite only.</span>
<span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #66cc66;">&#40;</span>db_name<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'master'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'tempdb'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">REVOKE</span> <span style="color: #993333; font-weight: bold;">CONNECT</span> <span style="color: #993333; font-weight: bold;">TO</span> guest
&nbsp;
<span style="color: #808080; font-style: italic;">-- Move all of the permissions given to public to FormerPublic</span>
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">ROLE</span> FormerPublic
&nbsp;
<span style="color: #993333; font-weight: bold;">DECLARE</span> PublicPermissions CURSOR STATIC READ_ONLY <span style="color: #993333; font-weight: bold;">FOR</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>
	Permission_Name<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span>O<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> DB_NAME<span style="color: #66cc66;">&#40;</span>Perms<span style="color: #66cc66;">.</span>major_id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> SecurableName<span style="color: #66cc66;">,</span>
	SCHEMA_NAME<span style="color: #66cc66;">&#40;</span>O<span style="color: #66cc66;">.</span>schema_id<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#91;</span>Schema<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> sys<span style="color: #66cc66;">.</span>database_permissions Perms
<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>database_principals Grantees <span style="color: #993333; font-weight: bold;">ON</span> Perms<span style="color: #66cc66;">.</span>Grantee_Principal_Id <span style="color: #66cc66;">=</span> Grantees<span style="color: #66cc66;">.</span>Principal_Id
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">OUTER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>all_objects O <span style="color: #993333; font-weight: bold;">ON</span> Perms<span style="color: #66cc66;">.</span>major_id <span style="color: #66cc66;">=</span> O<span style="color: #66cc66;">.</span>object_id
<span style="color: #993333; font-weight: bold;">WHERE</span> Grantees<span style="color: #66cc66;">.</span>Name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'public'</span> <span style="color: #993333; font-weight: bold;">AND</span> Grantees<span style="color: #66cc66;">.</span>Type_Desc <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'DATABASE_ROLE'</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">DECLARE</span>
	@PermissionName	sysname<span style="color: #66cc66;">,</span>
	@SecurableName	sysname<span style="color: #66cc66;">,</span>
	@SchemaName		sysname<span style="color: #66cc66;">,</span>
	@Arguments		nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	@FullCommand	nvarchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">OPEN</span> PublicPermissions
&nbsp;
FETCH <span style="color: #993333; font-weight: bold;">NEXT</span> <span style="color: #993333; font-weight: bold;">FROM</span> PublicPermissions
<span style="color: #993333; font-weight: bold;">INTO</span> @PermissionName<span style="color: #66cc66;">,</span> @SecurableName<span style="color: #66cc66;">,</span> @SchemaName
&nbsp;
WHILE <span style="color: #66cc66;">&#40;</span>@@FETCH_STATUS <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">BEGIN</span>
	<span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #66cc66;">&#40;</span>@SecurableName <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">BEGIN</span>
		<span style="color: #993333; font-weight: bold;">SET</span> @Arguments <span style="color: #66cc66;">=</span> @PermissionName <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' ON '</span>
			<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'['</span> <span style="color: #66cc66;">+</span> @SchemaName <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'].'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'['</span> <span style="color: #66cc66;">+</span> @SecurableName <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">']'</span>
&nbsp;
		<span style="color: #993333; font-weight: bold;">SET</span> @FullCommand <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'REVOKE '</span> <span style="color: #66cc66;">+</span> @Arguments <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' FROM public'</span>
		<span style="color: #993333; font-weight: bold;">EXEC</span> sp_executesql @FullCommand
&nbsp;
		<span style="color: #993333; font-weight: bold;">SET</span> @FullCommand <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'GRANT '</span> <span style="color: #66cc66;">+</span> @Arguments <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' TO FormerPublic'</span>
		<span style="color: #993333; font-weight: bold;">EXEC</span> sp_executesql @FullCommand
	<span style="color: #993333; font-weight: bold;">END</span>
&nbsp;
	FETCH <span style="color: #993333; font-weight: bold;">NEXT</span> <span style="color: #993333; font-weight: bold;">FROM</span> PublicPermissions
	<span style="color: #993333; font-weight: bold;">INTO</span> @PermissionName<span style="color: #66cc66;">,</span> @SecurableName<span style="color: #66cc66;">,</span> @SchemaName
<span style="color: #993333; font-weight: bold;">END</span>
&nbsp;
DEALLOCATE PublicPermissions</pre></div></div>

<h3 id="learnMore">Learn more</h3>
<ul class="learnMore">
<li>Microsoft&#8217;s <a href="http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SQL2005SecBestPract.doc">SQL2005 Security Best Practices</a> document</li>
<li>SQL Books Online offer <a href="http://technet.microsoft.com/en-us/library/ms161948.aspx">Security Considerations for SQL Server</a></li>
<li>Adam Machanic wrote a short and sweet list of <a href="http://searchsqlserver.techtarget.com/tip/1,289483,sid87_gci1132767,00.html">Top 10 Security Enhancements in SQL Server 2005</a></li>
<li>Don Kiely&#8217;s MSDN article on <a href="http://msdn.microsoft.com/msdnmag/issues/05/06/SQLServerSecurity/default.aspx">SQL Server Security</a></li>
<li>Read about <a href="http://msdn2.microsoft.com/en-us/library/ms190387.aspx">Schemas</a> in SQL Books Online</li>
</ul>
<p>&nbsp;</p>
<img src="http://osman.it/?ak_action=api_record_view&id=183&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Flock-down-sql-server-2005%2F&amp;title=Lock%20Down%20SQL%20Server%202005" id="wpa2a_8"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/lock-down-sql-server-2005/">Permalink</a> |
<a href="http://osman.it/sql-server/lock-down-sql-server-2005/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/lock-down-sql-server-2005/&title=Lock Down SQL Server 2005">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/lock-down-sql-server-2005/" rel="tag">Lock Down SQL Server 2005</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/lock-down-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS Team Blog</title>
		<link>http://osman.it/sql-server/ssis-team-blog/</link>
		<comments>http://osman.it/sql-server/ssis-team-blog/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 16:09:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSIS Team Blog]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=167</guid>
		<description><![CDATA[Microsoft SQL Server 2005 Integration Services (SSIS) is a platform for building high performance data integration solutions, including the extraction, transformation, and loading (ETL) of packages for data warehousing. SSIS is the new name assigned to the component formerly branded as Data Transformation Services (DTS). Helpful information and examples on how to use SQL Server [...]]]></description>
			<content:encoded><![CDATA[<p id="tagline">Microsoft SQL Server 2005 Integration Services (SSIS) is a platform for building high performance data integration solutions, including the extraction, transformation, and loading (ETL) of packages for data warehousing. SSIS is the new name assigned to the component formerly branded as Data Transformation Services (DTS).</p>
<p id="tagline">Helpful information and examples on how to use SQL Server Integration Services.</p>
<div id="LinkSideBar">
<h3>SSIS Blogs</h3>
<ul>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl01_Link" title="SSIS Talk" href="http://www.ssistalk.com/">Phil Brammer</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl02_Link" title="SSIS Junkie" href="http://blogs.conchango.com/jamiethomson/">Jamie Thomson</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl03_Link" href="http://rafael-salas.blogspot.com/">Rafael Salas</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl04_Link" href="http://agilebi.com/CS/blogs/jwelch/">John Welch</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl05_Link" href="http://blogs.msdn.com/michen/" rel="co-worker">Michael Entin</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl06_Link" href="http://pragmaticworks.com/community/blogs/brianknight/default.aspx">Brian Knight</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl07_Link" href="http://bi-polar23.blogspot.com/">Matthew Roche</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl08_Link" href="http://sqlblog.com/blogs/andy_leonard/default.aspx">Andy Leonard</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl00_Links_ctl09_Link" href="http://dougbert.com/default.aspx" rel="co-worker">Douglas Laudenschlager</a></li>
</ul>
<h3>SSIS Links</h3>
<ul>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl01_Link" title="Integration Services home page on MSDN" href="http://msdn2.microsoft.com/en-us/sql/aa336312.aspx">Integration Services</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl02_Link" title="Great SSIS resource" href="http://www.sqlis.com/">SQLIS.com</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl03_Link" href="http://ssis.wik.is/">Connectivity Wiki</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl04_Link" href="http://msdn2.microsoft.com/en-us/library/ms141026.aspx">SSIS Books Online</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl05_Link" title="MS BI recruiting blog" href="http://blogs.msdn.com/birecruiting/">BI Recruiting</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl06_Link" href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&amp;SiteID=1">MSDN Forums</a></li>
<li><a id="ctl00___ctl00___bs___lcl___Categories_ctl01_Links_ctl07_Link" title="SSIS tutorial videos" href="http://www.jumpstarttv.com/Channel.aspx?cat=c871236d-8554-42e3-8683-4d422356c0bd">JumpstartTV</a></li>
</ul>
</div>
<div id="content">
<div id="content2">
<div class="post">
<h2>&nbsp;</h2>
</div>
</div>
</div>
<img src="http://osman.it/?ak_action=api_record_view&id=167&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fssis-team-blog%2F&amp;title=SSIS%20Team%20Blog" id="wpa2a_10"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/ssis-team-blog/">Permalink</a> |
<a href="http://osman.it/sql-server/ssis-team-blog/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/ssis-team-blog/&title=SSIS Team Blog">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/ssis-team-blog/" rel="tag">SSIS Team Blog</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/ssis-team-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>string.Format in SQL</title>
		<link>http://osman.it/sql-server/stringformat-in-sql/</link>
		<comments>http://osman.it/sql-server/stringformat-in-sql/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 12:50:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[string.Format in SQL]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=146</guid>
		<description><![CDATA[I needed string.Format in SQL just now, so I made it up (not very exciting but nicer than writing nested REPLACE statements. YMMV &#160; DROP FUNCTION dbo.fnFormatString GO CREATE FUNCTION dbo.fnFormatString(@format varchar(6000), @arg1 sql_variant, @arg2 sql_variant='', @arg3 sql_variant='') RETURNS varchar(8000) AS BEGIN RETURN REPLACE( REPLACE( REPLACE(@format, '{0}', CAST(@arg1 as varchar(400))), '{1}', CAST(@arg2 as varchar(400))), '{2}', [...]]]></description>
			<content:encoded><![CDATA[<div class="postcontent">
<p><font face="Verdana" size="2">I needed string.Format in SQL just now, so I made it up (not very exciting but nicer than writing nested REPLACE statements. YMMV </font></p>
<p><font face="Verdana" size="2">&nbsp;</font></p>
<div style="background-color: #dddddd">
<pre>
DROP FUNCTION dbo.fnFormatString
GO
CREATE FUNCTION dbo.fnFormatString<span class="TPbracket">(</span>@format varchar<span class="TPbracket">(</span><span class="TPnumber">6000</span><span class="TPbracket">)</span>,
    @arg1 sql_variant,
    @arg2 sql_variant<span class="TPoperator">=</span><span class="TPchar">''</span>,
    @arg3 sql_variant<span class="TPoperator">=</span><span class="TPchar">''</span><span class="TPbracket">)</span>
RETURNS varchar<span class="TPbracket">(</span><span class="TPnumber">8000</span><span class="TPbracket">)</span>
AS
BEGIN
RETURN  REPLACE<span class="TPbracket">(</span>
    REPLACE<span class="TPbracket">(</span>
    REPLACE<span class="TPbracket">(</span>@format, <span class="TPchar">'{0}'</span>, CAST<span class="TPbracket">(</span>@arg1 as varchar<span class="TPbracket">(</span><span class="TPnumber">400</span><span class="TPbracket">)))</span>,
    <span class="TPchar">'{1}'</span>, CAST<span class="TPbracket">(</span>@arg2 as varchar<span class="TPbracket">(</span><span class="TPnumber">400</span><span class="TPbracket">)))</span>,
    <span class="TPchar">'{2}'</span>, CAST<span class="TPbracket">(</span>@arg3 as varchar<span class="TPbracket">(</span><span class="TPnumber">400</span><span class="TPbracket">)))</span>
END
GO
PRINT dbo.fnFormatString<span class="TPbracket">(</span><span class="TPchar">'This {0} of works like {1} in that langauge {2}'</span>
    , <span class="TPchar">'sorta'</span>
    , <span class="TPchar">'string.Format()'</span>
    , <span class="TPchar">'C#'</span><span class="TPbracket">)</span>
</pre>
</div>
</div>
<p>
&nbsp;</p>
<img src="http://osman.it/?ak_action=api_record_view&id=146&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fstringformat-in-sql%2F&amp;title=string.Format%20in%20SQL" id="wpa2a_12"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/stringformat-in-sql/">Permalink</a> |
<a href="http://osman.it/sql-server/stringformat-in-sql/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/stringformat-in-sql/&title=string.Format in SQL">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/stringformat-in-sql/" rel="tag">string.Format in SQL</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/stringformat-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database Schema change auditing</title>
		<link>http://osman.it/sql-server/sql-server-2005-database-schema-change-auditing/</link>
		<comments>http://osman.it/sql-server/sql-server-2005-database-schema-change-auditing/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 12:46:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Database Schema change auditing]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=144</guid>
		<description><![CDATA[I needed to implement a&#160;simple audit trail in SQL Server 2005. After googling and finding many, many ways, I&#160;found Richard&#8217;s recent blog post over at GeekDojo titled &#34;Super easy SQL Server 2005 Database Schema change auditing&#34;&#160;very interesting. Richard has posted a short, helpful script to audit data definition (CREATE, DROP, ALTER) SQL statements to a [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to implement a&nbsp;simple audit trail in SQL Server 2005. After googling and finding many, many ways, I&nbsp;found <a href="http://blogs.geekdojo.net/richard/default.aspx">Richard&#8217;s</a> recent blog post over at GeekDojo titled <a href="http://blogs.geekdojo.net/richard/archive/2007/06/04/134600.aspx">&quot;Super easy SQL Server 2005 Database Schema change auditing&quot;</a>&nbsp;very interesting.</p>
<p>Richard has posted a short, helpful script to audit data definition (CREATE, DROP, ALTER) SQL statements to a central table using a simple trigger and the XML data type. This means I can keep an audit trail of schema changes, along with all the information available (user name, date &amp; time, SQL statement, etc.)</p>
<img src="http://osman.it/?ak_action=api_record_view&id=144&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fsql-server-2005-database-schema-change-auditing%2F&amp;title=Database%20Schema%20change%20auditing" id="wpa2a_14"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/sql-server-2005-database-schema-change-auditing/">Permalink</a> |
<a href="http://osman.it/sql-server/sql-server-2005-database-schema-change-auditing/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/sql-server-2005-database-schema-change-auditing/&title=Database Schema change auditing">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/database-schema-change-auditing/" rel="tag">Database Schema change auditing</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/sql-server-2005-database-schema-change-auditing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Tools Features announced at Launch event</title>
		<link>http://osman.it/sql-server/new-tools-features-announced-at-launch-event/</link>
		<comments>http://osman.it/sql-server/new-tools-features-announced-at-launch-event/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 12:25:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[VS2008]]></category>
		<category><![CDATA[Windows Sever 2008]]></category>

		<guid isPermaLink="false">http://mdosman.us/?p=135</guid>
		<description><![CDATA[The SQL 2008, VS2008, Windows Sever 2008 launch event in the US happened this week. Dan Jones has some highlight features that were announced; T-SQL Debugger is back Object Search is back Activity Monitor has effectively been rewritten to improve perf and usefulness &#160; © admin for Mohammed Osman, 2008. &#124; Permalink &#124; No comment [...]]]></description>
			<content:encoded><![CDATA[<p>The SQL 2008, VS2008, Windows Sever 2008 launch event in the US happened this week. <a href="http://blogs.msdn.com/dtjones/archive/2008/02/28/sql-server-2008-launch-the-day-after.aspx">Dan Jones</a> has some highlight features that were announced;</p>
<ul>
<li>T-SQL Debugger is back</li>
<li>Object Search is back</li>
<li>Activity Monitor has effectively been rewritten to improve perf and usefulness</li>
</ul>
<p>&nbsp;</p>
<img src="http://osman.it/?ak_action=api_record_view&id=135&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fosman.it%2Fsql-server%2Fnew-tools-features-announced-at-launch-event%2F&amp;title=New%20Tools%20Features%20announced%20at%20Launch%20event" id="wpa2a_16"><img src="http://osman.it/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><hr />
<p><small>© admin for <a href="http://osman.it">Mohammed Osman</a>, 2008. |
<a href="http://osman.it/sql-server/new-tools-features-announced-at-launch-event/">Permalink</a> |
<a href="http://osman.it/sql-server/new-tools-features-announced-at-launch-event/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://osman.it/sql-server/new-tools-features-announced-at-launch-event/&title=New Tools Features announced at Launch event">del.icio.us</a>
<br/>
Post tags: <a href="http://osman.it/tag/sql-2008/" rel="tag">SQL 2008</a>, <a href="http://osman.it/tag/vs2008/" rel="tag">VS2008</a>, <a href="http://osman.it/tag/windows-sever-2008/" rel="tag">Windows Sever 2008</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://osman.it/sql-server/new-tools-features-announced-at-launch-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

