<?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>Search results matching tags 'SSMS' and 'scripting'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=SSMS,scripting&amp;orTags=0</link><description>Search results matching tags 'SSMS' and 'scripting'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Connect Digest : 2012-07-06</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2012/07/06/connect-digest-2012-07-06.aspx</link><pubDate>Fri, 06 Jul 2012 14:37:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:44218</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;I've filed a few Connect items recently that I think are important.&lt;/p&gt;

&lt;hr&gt;&lt;p&gt;In &lt;a href=http://connect.microsoft.com/SQLServer/feedback/details/752210/doc-ddl-trigger-topic-suggests-that-rollbacks-run-before-action target=_blank&gt;#752210&lt;/a&gt;, I complain that the documentation for DDL triggers suggests that they can prevent certain DDL from being run, which is not the case at all.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &lt;a href=http://connect.microsoft.com/SQLServer/feedback/details/752210/doc-ddl-trigger-topic-suggests-that-rollbacks-run-before-action target=_blank&gt;http://connect.microsoft.com/SQLServer/feedback/details/752210/doc-ddl-trigger-topic-suggests-that-rollbacks-run-before-action&lt;/a&gt;&lt;/p&gt;

&lt;hr&gt;
&lt;p&gt;In &lt;a target=_blank href=http://connect.microsoft.com/SQLServer/feedback/details/745796/ssms-generate-scripts-for-data-scripts-datetime-as-binary&gt;#745796&lt;/a&gt;, I complain that scripting datetime data in Management Studio yields output that contains a binary representation instead of a human-readable string. I suspect this is to avoid ambiguity but I guess someone forgot that there are unambiguous formats available (*cough* YYYYMMDD *cough*). &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &lt;a target=_blank href=http://connect.microsoft.com/SQLServer/feedback/details/745796/ssms-generate-scripts-for-data-scripts-datetime-as-binary&gt;http://connect.microsoft.com/SQLServer/feedback/details/745796/ssms-generate-scripts-for-data-scripts-datetime-as-binary&lt;/a&gt;&lt;/p&gt;

&lt;hr&gt;
&lt;p&gt;In &lt;a href=http://connect.microsoft.com/SQLServer/feedback/details/752629/disable-sp-msforeachdb-by-default-or-fix-it target=_blank&gt;#752629&lt;/a&gt;, I complain about the broken procedure sp_msforeachdb, which I've &lt;a target=_blank href=http://sqlblog.com/blogs/aaron_bertrand/archive/2010/02/08/bad-habits-to-kick-relying-on-undocumented-behavior.aspx&gt;complained about&lt;/a&gt; &lt;a target=_blank href=http://sqlblog.com/blogs/aaron_bertrand/archive/2010/12/29/a-more-reliable-and-more-flexible-sp-msforeachdb.aspx&gt;many times before&lt;/a&gt; and have even &lt;a target=_blank href=http://www.mssqltips.com/sqlservertip/2201/making-a-more-reliable-and-flexible-spmsforeachdb /&gt;written a more functional, alternative version that actually works&lt;/a&gt;. I really think they need an ultimatum here: either fix the thing or turn it off by default. The only downside to turning it off by default: this will break maintenance plans that are probably breaking silently anyway.&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &lt;a href=http://connect.microsoft.com/SQLServer/feedback/details/752629/disable-sp-msforeachdb-by-default-or-fix-it target=_blank&gt;http://connect.microsoft.com/SQLServer/feedback/details/752629/disable-sp-msforeachdb-by-default-or-fix-it&lt;/a&gt;&lt;/p&gt;
&amp;nbsp;&lt;br&gt;</description></item><item><title>Connect Digest : 2011-08-08</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/08/08/connect-digest-2011-07-05.aspx</link><pubDate>Mon, 08 Aug 2011 12:30:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:36489</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;This week I reported a few bugs - one with sp_helptext, one with Activity Monitor in Management Studio, and one in the new sys.dm_server_services DMV.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/683234/sp-helptext-treats-non-system-objects-as-system-objects" title="http://connect.microsoft.com/SQLServer/feedback/details/683234/sp-helptext-treats-non-system-objects-as-system-objects" target="_blank"&gt;#683234 : sp_helptext treats non-system objects as system objects&lt;/a&gt; &lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;For this one there is at least one weird case where running sp_helptext against on object prefixed with dbo ignores the dbo and tries to retrieve text for its sys counterpart (in this case, you can't run sp_helptext against a procedure you can create and execute called dbo.sp_hexadecimal; instead, you get error 15197, because the system thinks your object is a system object). I &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2011/08/06/sys-sp-hexadecimal-a-quasi-system-object.aspx" title="http://sqlblog.com/blogs/aaron_bertrand/archive/2011/08/06/sys-sp-hexadecimal-a-quasi-system-object.aspx" target="_blank"&gt;blogged about this situation&lt;/a&gt; over the weekend as well.&lt;br&gt; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/683031/ssms-activity-monitor-execution-plan-implies-that-sqlplan-file-is-saved" title="http://connect.microsoft.com/SQLServer/feedback/details/683031/ssms-activity-monitor-execution-plan-implies-that-sqlplan-file-is-saved" target="_blank"&gt;#683031 : SSMS : Activity Monitor, execution plan implies that .sqlplan file is saved&lt;/a&gt; &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;In testing the new Management Studio add-in we created for &lt;a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp" title="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp" target="_blank"&gt;SQL Sentry Plan Explorer&lt;/a&gt;, it was discovered that the file handle SSMS associates with execution plans launched from within Activity Monitor is not valid - it says the file is in %USERPROFILE%\Documents, but the file is not actually there until you manually save it. &lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/683275/sys-dm-server-services-has-two-rows-for-sql-server-agent-in-ctp3" title="http://connect.microsoft.com/SQLServer/feedback/details/683275/sys-dm-server-services-has-two-rows-for-sql-server-agent-in-ctp3" target="_blank"&gt;#683275 : sys.dm_server_services has two rows for SQL Server Agent in CTP3&lt;/a&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt; This DMV is new in Denali and 2008 R2 SP1 (though the bug I've reported seems to only affect Denali CTP3). I had previously reported that &lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/664557/sys-dm-server-services-last-startup-time-is-always-null-for-sql-agent" title="https://connect.microsoft.com/SQLServer/feedback/details/664557/sys-dm-server-services-last-startup-time-is-always-null-for-sql-agent" target="_blank"&gt;last_startup_time is always NULL for SQL Server Agent&lt;/a&gt;; that bug does affect both 2008 R2 and Denali.&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br&gt;Then I have five others I'd like to highlight, only because they crossed my path for one reason or another. In no particular order:&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/668871/tsql-stop-the-stuff-function-treating-null-as-the-empty-string" title="http://connect.microsoft.com/SQLServer/feedback/details/668871/tsql-stop-the-stuff-function-treating-null-as-the-empty-string" target="_blank"&gt;#668871 : TSQL - Stop the STUFF function treating NULL as the empty string&lt;/a&gt; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;While they've confirmed that they are not going to fix STUFF, the key here is to put in some comments suggesting why the ANSI-standard OVERLAY function would be a useful addition to T-SQL. (Or maybe create a new suggestion.)&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/256665/extend-object-definition-to-include-more-objects" title="http://connect.microsoft.com/SQLServer/feedback/details/256665/extend-object-definition-to-include-more-objects" target="_blank"&gt;#256665 : Extend OBJECT_DEFINITION to include more objects&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;I would love to be able to call a function that gives me the script for that object - be it CREATE TABLE, CREATE VIEW, CREATE SYNONYM, what have you. Currently this function only works for "script" objects, such as functions, procedures and views. If you've ever tried to manually/programmatically re-create the type of script Management Studio spits out for a table, you should have no problems voting this one up.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/640236/the-optimizer-should-considering-materialising-results-of-ctes" title="http://connect.microsoft.com/SQLServer/feedback/details/640236/the-optimizer-should-considering-materialising-results-of-ctes" target="_blank"&gt;#640236 : The optimizer should considering materialising results of CTEs&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Erland filed this one that properly suggests that a CTE *should* be able to be materialized by the optimizer only once, instead of up to (and sometimes more than) as many times as it is referenced in the rest of the query. For some insight into how much performance can be affected when the CTE is materialized only once, see &lt;a href="http://sqlcat.com/msdnmirror/archive/2011/04/28/optimize-recursive-cte-query.aspx" title="http://sqlcat.com/msdnmirror/archive/2011/04/28/optimize-recursive-cte-query.aspx" target="_blank"&gt;this blog post from SQLCAT&lt;/a&gt;. For more viewpoints on the problem, see &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/218968/" title="http://connect.microsoft.com/SQLServer/feedback/details/218968/" target="_blank"&gt;Connect #218968&lt;/a&gt;, &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/377976/non-recursive-ctes-inefficiently-recompute-self-joins-and-row-number-instead-of-using-worktable" title="http://connect.microsoft.com/SQLServer/feedback/details/377976/non-recursive-ctes-inefficiently-recompute-self-joins-and-row-number-instead-of-using-worktable" target="_blank"&gt;Connect #377976&lt;/a&gt; and &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/483181/additional-query-hint-option-materialize-cte-name-n" title="http://connect.microsoft.com/SQLServer/feedback/details/483181/additional-query-hint-option-materialize-cte-name-n" target="_blank"&gt;Connect #483181&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/640863/please-allow-creation-of-temporary-views" title="http://connect.microsoft.com/SQLServer/feedback/details/640863/please-allow-creation-of-temporary-views" target="_blank"&gt;#640863 : Please allow creation of temporary views&lt;/a&gt; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;I don't think I would have very many uses for this one, but I can see the use case that is being presented. The workaround suggested by Microsoft (to create a view in tempdb, then drop it) is no more useful than creating a permanent view in the current database and then dropping it - the problem is that only one user could do this at a time. &lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/127219/create-or-replace" title="http://connect.microsoft.com/SQLServer/feedback/details/127219/create-or-replace" target="_blank"&gt;#127219 : CREATE OR REPLACE&lt;/a&gt; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;I've probably talked about this one before. Because of the complications with checking for existence of a stored procedure, for example, and the fact that a CREATE or ALTER PROCEDURE command must be the only statement in a batch, it is very difficult to determine the correct action without building the procedure body in dynamic SQL. On top of those, if you just blindly DROP and CREATE each time, you lose permissions, dependencies, etc. So the ability to say CREATE OR REPLACE or CREATE OR ALTER instead of performing these checks and executing one script or the other, would be welcome indeed.&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;</description></item><item><title>Connect Digest : 2009-08-22</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2009/08/21/connect-digest-2009-08-22.aspx</link><pubDate>Sat, 22 Aug 2009 03:18:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16113</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;I rounded up a few interesting items this week.
&lt;/p&gt;
&lt;hr style="height:1px;"&gt;
&lt;p&gt;&lt;b&gt;Does "1/10/1900" mean January 10th, or October 1st?&lt;/b&gt; &lt;br&gt;&lt;/p&gt;

&lt;p&gt;This item demonstrates that Microsoft isn't all that concerned about publishing sample code that uses ambiguous or troublesome formats for date literals.&amp;nbsp; Initially the Books Online topics mentioned in the item used "1/10/1900" as a date literal, and of course that would have a different meaning in a default US English locale compared with a British locale.&amp;nbsp; The alleged 'fix' was to change the string to "January 1, 1900."&amp;nbsp; Which will simply fail if the user has, for example, SET LANGUAGE FRENCH.&amp;nbsp; It seems funny that they could make a change for the better within a few days, but then making another change (also for the better) cannot be done due to costs.&amp;nbsp; Whereas if they had just changed "1/10/1900" to "19000101" in the first place, the problem would have been solved in one step.&amp;nbsp; What a weird organization they have over there; I personally think that the people writing their documentation samples should be assigned random locales and SET LANGUAGE settings so that they aren't writing code in a nice little US English vacuum.&amp;nbsp; I can imagine a scenario where you have a bank of servers to deploy to, and you have to test on one of them, but you never know which one you're going to get... when your code blows up because the German server with SET LANGUAGE DUTCH doesn't know what "February" means, you have to go back to the drawing board.&amp;nbsp; And I think this would be beneficial for everyone.&lt;br&gt;&lt;/p&gt;
&lt;div style="margin-left:40px;" class="SubTitle"&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=482186" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=482186" target="_blank"&gt;#482186 : DOC : Add/Subtract topics should warn about DATE / TIME types&lt;/a&gt;&lt;br&gt;&amp;nbsp;&lt;/div&gt;

&lt;hr style="height:1px;"&gt;
&lt;p&gt;&lt;b&gt;Why can't we have an easier way to get first day of month, of year, etc.?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;We currently use clumsy methods to get the first day of the week, month or year (given a DATETIME/SMALLDATETIME value), or to strip the time.&amp;nbsp; While the DATE data type in SQL Server 2008 will relieve some of this pain, it won't help in all cases.&amp;nbsp; Meanwhile, other RDBMS have much more convenient ways to do this (e.g. Oracle's TRUNC()).&amp;nbsp; I am hopeful that someday they will add a function like this to SQL Server; I call it "DATEROUND."&lt;/p&gt;

&lt;blockquote&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483913" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483913" target="_blank" id="ctl00_MasterBody_PostedByUserView_ctl01_FeedbackSummaryDisplay_FeedbackLink"&gt;#483913 : Add a DATEROUND 
function similar to Oracle's TRUNC() for date handling&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=482186" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=482186" target="_blank"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;hr style="height:1px;"&gt;
&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=482186" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=482186" target="_blank"&gt;&lt;/a&gt;
&lt;p&gt;&lt;b&gt;Why do we allow identifiers with trailing spaces?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;While this may not be common practice (notice the trailing spaces in the table and column names)...&lt;/p&gt;

&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE&amp;nbsp;TABLE&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;dbo.[foo&amp;nbsp;]&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[bar&amp;nbsp;]&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;INT&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;...there are end users complaining about the fact that this works (see &lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483389" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483389" target="_blank"&gt;Connect #483389&lt;/a&gt;).&amp;nbsp; I had a slightly different take than user "aitcha1" in that I don't understand why SQL Server allows trailing spaces in identifier names in the first place.&amp;nbsp; It does ignore trailing spaces when preventing duplicates (for example, you can't have a column named [bar] and a column named [bar ]), but in spite of what the documentation says, it certainly keeps the space intact when storing the metadata in the catalog views.&amp;nbsp; So I filed two suggestions: one to fix the documentation to be more explicit about how "SQL Server stores the name without the trailing spaces," and one to actually tighten up identifier rules.&lt;/p&gt;

&lt;div style="margin-left:40px;" class="SubTitle"&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483553" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483553" target="_blank"&gt;#483553 : DOC : Delimited Identifiers topic lies about trailing spaces&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-left:40px;" class="SubTitle"&gt;&amp;nbsp;&lt;/div&gt;&lt;div style="margin-left:40px;" class="SubTitle"&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483527" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=483527" target="_blank"&gt;#483527 : Tighten up identifier rules&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;/div&gt;

&lt;hr style="height:1px;"&gt;
&lt;p&gt;&lt;b&gt;Why does SSMS not like VARCHAR(MAX) parameters?&lt;/b&gt; &lt;br&gt;&lt;/p&gt;

&lt;p&gt;There was an avid discussion on the newsgroups this week about a long-acknowledged bug in SSMS.  If you have a stored procedure that has a VARCHAR(MAX) parameter, and you open Object Explorer, right-click the procedure and choose Script As &amp;gt; Execute &amp;gt; New Query Window, the variable declaration for that parameter is simply VARCHAR, not VARCHAR(MAX).  Obviously this isn't a huge show-stopper, and an easy workaround is to use NVARCHAR(MAX) parameters (if this is acceptable), but I also believe that this can't be a very difficult bug to fix.&amp;nbsp; I tried to use Profiler to peek at what SSMS calls when you run this script, but they are only retrieving metadata and not revealing how they are actually building the output that you ultimately execute.&amp;nbsp; My guess is that there is just a bug when handling VARCHAR() types where max_length = -1.&amp;nbsp; Anyway the bug has been sitting around for almost three years and could possibly use a little traffic.&lt;br&gt;&lt;/p&gt;
&lt;div style="margin-left:40px;" class="SubTitle"&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=241782" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=241782" target="_blank"&gt;#241782 : create script for sp execute in parameter varchar(max) wrong&lt;/a&gt;&lt;br&gt;&amp;nbsp;&lt;/div&gt;

&lt;hr style="height:1px;"&gt;
&lt;p&gt;&lt;b&gt;Who coded that infinite loop?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In several Windows collations (e.g. Latin1_General_CI_AS), when performing a REPLACE() of CHAR(0), the SQL engine can enter an infinite loop and consume multiple CPUs.&amp;nbsp; A problem with CHAR(0) was first reported by Erland back in 2006, but the infinite loop was a much more recent revelation (it was added in a comment this week, and may appear in an independent Connect item in the future).&lt;br&gt;&lt;/p&gt;

&lt;p style="margin-left:40px;"&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=125502" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=125502" target="_blank"&gt;#125502 : Replace of char(0) does not work in DB with Windows collation&lt;br&gt;&lt;br&gt;&lt;/a&gt;&lt;/p&gt;

&lt;hr style="height:1px;"&gt;&lt;br&gt;&lt;b&gt;Can we have an option to turn off deferred name resolution?
&lt;/b&gt;
&lt;p&gt;Deferred name resolution is confusing, and has even created a market for 3rd party products that track dependencies  better than SQL Server can do on its own (e.g. Red-Gate's &lt;a href="http://www.red-gate.com/products/SQL_Dependency_tracker/index.htm" title="http://www.red-gate.com/products/SQL_Dependency_tracker/index.htm" target="_blank"&gt;SQL Dependency Tracker&lt;/a&gt;).&amp;nbsp; We know that if we create a stored procedure that calls another stored procedure that doesn't yet exist, the parser still allows us to create the procedure, giving us the benefit of the doubt that we will create the other procedure later.&amp;nbsp; So in this case, we get a warning message:&lt;/p&gt;


&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE&amp;nbsp;PROCEDURE&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;dbo.test1&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;AS&lt;br&gt;BEGIN&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;EXEC&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;dbo.proc_does_not_exist&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;GO&lt;/font&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;br&gt;
&lt;table bgcolor="#efefef" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;Cannot add rows to sys.sql_dependencies for the stored procedure because it depends &lt;br&gt;on the missing table 'dbo.proc_does_not_exist'. The stored procedure will still be &lt;br&gt;created; however, it cannot be successfully executed until the table exists.&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;p&gt;The warning message incorrectly says "table" when it should probably say "object."&amp;nbsp; In SQL Server 2008, the error message is actually: &lt;br&gt;&lt;/p&gt;

&lt;table bgcolor="#efefef" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;The module 'test1' depends on the missing object 'dbo.proc_does_not_exist'. The module &lt;br&gt;will still be created; however, it cannot run successfully until the object exists.&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;Sadly, we don't get a warning or an error if we reference a table that doesn't yet exist:&lt;/p&gt;


&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE&amp;nbsp;PROCEDURE&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;dbo.test2&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;AS&lt;br&gt;BEGIN&lt;br&gt;&amp;nbsp;&amp;nbsp; SELECT &lt;font color="gray"&gt;*&lt;/font&gt; FROM &lt;/font&gt;&lt;font color="black"&gt;dbo.table_does_not_exist&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;GO&lt;/font&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;br&gt;
&lt;table bgcolor="#efefef" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;Command(s) completed successfully.&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;This was complained about in &lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=246014" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=246014" target="_blank"&gt;Connect #246014&lt;/a&gt;, which was closed as fixed, however the parser is still silent about the problem in SQL Server 2008 (where we are told it has been addressed).&amp;nbsp; I guess the "fixed" part is just that the error message when the referenced object is NOT a table no longer incorrectly says "table."&amp;nbsp; :-(&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Deferred name resolution falls completely on its face if we reference a column that DOES NOT (yet) exist, in a table that DOES exist.&amp;nbsp; Where is our benefit of the doubt now?&amp;nbsp; This stored procedure won't compile, even if we intend to go create the column immediately:&lt;/p&gt;


&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE&amp;nbsp;TABLE&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;dbo.foo&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;bar &lt;/font&gt;&lt;font color="blue"&gt;INT&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;);&lt;br&gt;&lt;/font&gt;&lt;font&gt;&lt;font color="blue"&gt;GO&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;font color="blue"&gt;CREATE&amp;nbsp;PROCEDURE&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;dbo.test3&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;AS&lt;br&gt;BEGIN&lt;br&gt;&amp;nbsp;&amp;nbsp; SELECT &lt;/font&gt;&lt;font&gt;&lt;font color="black"&gt;column_does_not_exist&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; FROM &lt;/font&gt;&lt;font color="black"&gt;dbo.foo&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;GO&lt;/font&gt;&lt;br&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;

&lt;br&gt;
&lt;table bgcolor="#efefef" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;-moz-background-clip:border;-moz-background-origin:padding;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="red"&gt;Msg 207, Level 16, State 1, Procedure test3, Line 3&lt;br&gt;Invalid column name 'column_does_not_exist'.&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;p&gt;As alluded to, dependency tracking gets better in SQL Server 2008, as *some* unresolved dependencies are stored in sys.dm_sql_referenced_entities.&amp;nbsp; I wrote a lengthy blog post about this last year:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2008/09/09/keeping-sysdepends-up-to-date-in-sql-server-2008.aspx" title="http://sqlblog.com/blogs/aaron_bertrand/archive/2008/09/09/keeping-sysdepends-up-to-date-in-sql-server-2008.aspx" target="_blank"&gt;Keeping sysdepends up to date in SQL Server 2008&lt;/a&gt;&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;But I would still like to make it impossible to create anything (even a synonym) that references an object that doesn't yet exist.&amp;nbsp; Erland goes into much more detail about this in &lt;a href="http://www.sommarskog.se/strict_checks.html" title="http://www.sommarskog.se/strict_checks.html" target="_blank"&gt;his paper on SET STRICT_CHECKS ON&lt;/a&gt;.&amp;nbsp; You can't vote on that, but you could vote on these:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=127152" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=" target="_blank"&gt;#127152 : Ability to disable or workaround deferred name resolution&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=287100" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=287100" target="_blank"&gt;#287100 : Turn off deferred name resolution for CREATE SYNONYM&lt;/a&gt;&lt;/p&gt;
&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=260762" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=260762" target="_blank"&gt;#260762 : Add optional checks for more robust development&lt;/a&gt;&lt;br&gt;&lt;/blockquote&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>