<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://bloggingabout.net/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>Developer Pills : SQL Server</title><link>http://bloggingabout.net/blogs/adelkhalil/archive/tags/SQL+Server/default.aspx</link><description>Tags: SQL Server</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>The Myth of Stored Procedures Preference</title><link>http://bloggingabout.net/blogs/adelkhalil/archive/2008/01/06/the-myth-of-stored-procedures-preference.aspx</link><pubDate>Sat, 05 Jan 2008 22:16:28 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:453656</guid><dc:creator>Adel Khalil</dc:creator><slash:comments>46</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/adelkhalil/rsscomments.aspx?PostID=453656</wfw:commentRss><comments>http://bloggingabout.net/blogs/adelkhalil/archive/2008/01/06/the-myth-of-stored-procedures-preference.aspx#comments</comments><description>&lt;p&gt;When looking to the Stored Proscedures debate, there is always those three factors you should measure by.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Productivity&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;- Span code base over multiple staging environments is a pain and harder to maintain.&lt;/p&gt; &lt;p&gt;- Versioning sp code is way harder than versioning application code.&lt;/p&gt; &lt;p&gt;- Minor change to the design require changing in both the SPs and the DAL code.&lt;/p&gt; &lt;p&gt;- Todays IDEs are more advanced than most of the RDBMS offers, implementing on IDEs is obviously preferable.&lt;/p&gt; &lt;p&gt;- Switching between two seprate world to implement single method is always pain.&lt;/p&gt; &lt;p&gt;- It&amp;#39;s impossible to cover every single scenario and write SP for it, which will lead to write these SP as you go, huge consistency problem.&lt;/p&gt; &lt;p&gt;- There is no way to only update single param in the Update method using SPs as there isn&amp;#39;t optional parameters, on every update you need to supply full param collection.&lt;/p&gt; &lt;p&gt;- SPs are not portable if you want to develop application that run over multiple DBMS you will be writing SPs for each DBMS, standard SQL is portable.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;- Big myth over here, using SPs not guarante best security practice and certinly dosn&amp;#39;t mean that your application is SQL Injection proof you can write code like this&lt;/p&gt; &lt;p&gt;string s = &amp;quot;EXEC sp_GetCustomerByEmail &amp;#39;&amp;quot; + txtEmailAddress.Text + &amp;quot;&amp;#39;&amp;quot;;&lt;/p&gt; &lt;p&gt;and you will be using SP and still open to all kind of SQL Injection.&lt;/p&gt; &lt;p&gt;- Another myth regarding security is that if you are using Ad-hoc queries you *most likely* grand permissions for CRUD operations for your application user on the database, no you are not, that&amp;#39;s why Views are invented.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;often when SPs vs. Ad-hoc queries debate intoduced the performance card played, SPs advocates says SPs are pre-compiled which is not let met quate like &lt;a href="http://weblogs.asp.net/fbouma/archive/2003/11/18/38178.aspx" target="_blank"&gt;Frans&lt;/a&gt; did from SQL Server Books Online&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;&lt;font color="#626262"&gt;SQL Server 2000 and SQL Server version 7.0 incorporate a number of changes to statement processing that extend many of the performance benefits of stored procedures to all SQL statements. SQL Server 2000 and SQL Server 7.0 do not save a partially compiled plan for stored procedures when they are created. A stored procedure is compiled at execution time, like any other Transact-SQL statement. SQL Server 2000 and SQL Server 7.0 retain execution plans for all SQL statements in the procedure cache, not just stored procedure execution plans.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;So with no pre-compilation and caching for both SPs and SQL statments there is no advantage for SPs here, in some other databases the SPs compiled into C or C++ but this isn&amp;#39;t the case in SQL Server 7.0/2000.&lt;/p&gt; &lt;p&gt;I have introuduced my view on the SP vs. Dynamic SQL i don&amp;#39;t see any benfit of SPs over the huge amount of productivity, performance that you will gain with dynamic SQL, the only benfit in peformance you will get it when using Managed SPs (SQL Server 2005) but for 0.7/2000 SPs isn&amp;#39;t the right choice for most of the scenarios.&lt;/p&gt; &lt;p&gt;Read more (diverse views):&lt;/p&gt; &lt;p&gt;- Frans Bouma&amp;#39;s &lt;a href="http://weblogs.asp.net/fbouma/archive/2003/11/18/38178.aspx"&gt;Stored procedures are bad, m&amp;#39;kay?&lt;/a&gt;&lt;/p&gt; &lt;p&gt;- Jeff Atwood&amp;#39;s &lt;a href="http://www.codinghorror.com/blog/archives/000292.html" target="_blank"&gt;Stored Procs vs. Ad-hoc&lt;/a&gt; , &lt;a href="http://www.codinghorror.com/blog/archives/000275.html" target="_blank"&gt;Give me parametrized SQL, or give me death&lt;/a&gt;&lt;/p&gt; &lt;p&gt;- Eric Wise&amp;#39;s &lt;a target="_blank"&gt;The Pragmatic Adhoc SQL vs Stored Procedures Discussion&lt;/a&gt;&lt;/p&gt; &lt;p&gt;- Rob Howard&amp;#39;s &lt;a href="http://weblogs.asp.net/rhoward/archive/2003/11/17/38095.aspx" target="_blank"&gt;Don&amp;#39;t use stored procedures yet? Must be suffering from NIHS (Not Invented Here Syndrome)&lt;/a&gt;&lt;/p&gt; &lt;p&gt;- Jeremy D. Miller&amp;#39;s &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2006/05/25/145450.aspx" target="_blank"&gt;Why I do not use Stored Procedures&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=453656" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Security/default.aspx">Security</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Performance/default.aspx">Performance</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Software+Design/default.aspx">Software Design</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Database/default.aspx">Database</category></item><item><title>Database diagrams won't work in SQL Server 2005</title><link>http://bloggingabout.net/blogs/adelkhalil/archive/2007/03/16/database-diagrams-won-t-work-in-sql-server-2005.aspx</link><pubDate>Fri, 16 Mar 2007 03:45:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:140200</guid><dc:creator>Adel Khalil</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/adelkhalil/rsscomments.aspx?PostID=140200</wfw:commentRss><comments>http://bloggingabout.net/blogs/adelkhalil/archive/2007/03/16/database-diagrams-won-t-work-in-sql-server-2005.aspx#comments</comments><description>&lt;P&gt;I had this annoying error when trying to add new database diagram to SQL Server 2005 i received the error &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And even when i tried what the error message suggests didn't work.. i Google the issue i found many others suffering from the same and even when i tried the solutions introduced and&amp;nbsp;never worked for me&amp;nbsp;also reseting the compatibility for the database one step back to SQL Server 2000.. this how this error resolved which is itried before via Managment Studio but didn't work only did from a SQL Quary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008040&gt;EXEC sp_dbcmptlevel 'Dashboard', '90'; &lt;/FONT&gt;
&lt;P&gt;&lt;FONT color=#008040&gt;ALTER AUTHORIZATION ON DATABASE::Dashboard TO sa&lt;/FONT&gt; 
&lt;P&gt;So keep in mind if you ever ran into this.&lt;/P&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=140200" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Error/default.aspx">Error</category></item><item><title>Live from MDC 07</title><link>http://bloggingabout.net/blogs/adelkhalil/archive/2007/02/04/live-from-mdc-07.aspx</link><pubDate>Sun, 04 Feb 2007 03:06:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:107451</guid><dc:creator>Adel Khalil</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/adelkhalil/rsscomments.aspx?PostID=107451</wfw:commentRss><comments>http://bloggingabout.net/blogs/adelkhalil/archive/2007/02/04/live-from-mdc-07.aspx#comments</comments><description>&lt;P&gt;Hi, guys posting live from MDC 07 and just finish the seconed session.... so far theres two sessions presented by TOP IT and New Horizon delivering an overview of .NET Framework 3.0 as the first session and the one just finished talked about SQL Server OLTP.&lt;/P&gt;
&lt;P&gt;stay tuned...for these topics resources&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=107451" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/.NET/default.aspx">.NET</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Events/default.aspx">Events</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/MDC+07/default.aspx">MDC 07</category></item><item><title>In your face -  SQL Server 2005 security flaws since release = 0</title><link>http://bloggingabout.net/blogs/adelkhalil/archive/2006/11/29/In-your-face-_2D00_--SQL-Server-2005-security-flaws-since-release-_3D00_-0.aspx</link><pubDate>Wed, 29 Nov 2006 09:02:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:61063</guid><dc:creator>Adel Khalil</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/adelkhalil/rsscomments.aspx?PostID=61063</wfw:commentRss><comments>http://bloggingabout.net/blogs/adelkhalil/archive/2006/11/29/In-your-face-_2D00_--SQL-Server-2005-security-flaws-since-release-_3D00_-0.aspx#comments</comments><description>&lt;P&gt;Usualy Oracle known as the most secure database since decade but this truth is now changed in dramatic way.&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG style="WIDTH:595px;HEIGHT:314px;" height=332 alt="Oracle vs. SQL Server - Security flaws" src="http://www.AdelKhalil.com/home/sql_vs_oracle.PNG" width=612&gt;&lt;/P&gt;&lt;FONT face=Tahoma size=2&gt;
&lt;P align=left&gt;The two graphs above show the number of security flaws in the Oracle and Microsoft database servers that have been discovered and fixed since December 2000 until November 2006.&lt;/P&gt;
&lt;P align=left&gt;theres a blog post &lt;A href="http://bloggingabout.net/blogs/dennis/archive/2006/11/22/Secure-databases-_3A00_-SQL-Server-vs.-Oracle.aspx"&gt;here&lt;/A&gt;&amp;nbsp;by Dennis van der Stelt raised this issue and you may read the original research &lt;A href="http://www.databasesecurity.com/dbsec/comparison.pdf"&gt;here&lt;/A&gt;&amp;nbsp;[PDF]&amp;nbsp;.&lt;/P&gt;
&lt;P align=left&gt;i used to have a friend he is a Java developer and Oracle big fan.. and we used to have long conversations about whos is more secure, relaiable ..etc.. and now finally i can say to him IN YOUR FACE....&lt;/P&gt;
&lt;P align=left&gt;Now guys what do you think ? is Microsoft products finally getting better ?&lt;/P&gt;&lt;/FONT&gt;&lt;A href="http://www.dotnetkicks.com/kick/?url=http://bloggingabout.net/blogs/adelkhalil/archive/2006/11/29/In-your-face-_2D00_--SQL-Server-2005-security-flaws-since-release-_3D00_-0.aspx"&gt;&lt;IMG alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://bloggingabout.net/blogs/adelkhalil/archive/2006/11/29/In-your-face-_2D00_--SQL-Server-2005-security-flaws-since-release-_3D00_-0.aspx" border=0&gt;&lt;/A&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=61063" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://bloggingabout.net/blogs/adelkhalil/archive/tags/Security/default.aspx">Security</category></item></channel></rss>