SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

The Voice of the DBA

Code Reviews

This editorial was originally published on Apr 24, 2015. It is being republished as Steve is out of the office.

When I first started to be paid money to write software, I worked on my own. I had to test my own code, decide when it could be deployed, and make the decision to deploy it. I had to notify users, and over time, I had to delay deployments because my mistakes would stop a business from getting work done. Fortunately I didn't cause any serious loss of revenue for a small construction company due to my coding errors.

Later I worked at a large company and was surprised when I finished a piece of work and had to submit to a code review. My boss told me to get two other programmers, at least one a senior level developer, and have them review my code. In those days we reviewed code on paper, with a red pen reminiscent of my school days. The amount of ink expended on my work was a bit overwhelming, but fortunately I recovered and was able to fix most of the issues quickly.

I've talked to a number of developers over the years and it seems that most of them make their own decisions about how ready their work is for deployment. Code reviews seem to be the exception rather than the rule, but I wasn't sure if that was the case for SQL Server professionals. Are we more conservative and formal in our approaches? Here's the question this week.

Do you perform code reviews?

Do you review just application code (C#, Java, etc)? Are stored procedures and functions included? Do you include DDL and DML changes in reviews? Are DBAs able to apply changes to production without a second employee checking them?

In many ways, despite the stereotype that DBAs want to be careful with their systems, I've seen many DBAs rashly apply a change to a production server without any oversight or second opinons. It has seemed to me that having the control to decide what changes are made to a SQL Server instance has led to the execution of that power without any oversight for many individuals.

Let us know this week if you review code, and what things matter. I certainly thing naming and structure matter, though I'm willing to let formatting go as many tools these days will reformat code in whatever structure an individual developer prefers.

Steve Jones from SQLServerCentral.com

Join the debate, and respond to today's editorial on the forums

ADVERTISEMENT
SQL Monitor

The 4 pillars of SQL Server Monitoring

5 SQL Server experts; Grant Fritchey, Rodney Landrum, Kathi Kellenberger, Phil Factor and Tony Davis, use their many years of experience working and maintaining data systems to explain the 4 key strategies required for a successful, estate-wide monitoring solution.  Download your free copy now

SQL Prompt

Write, format, analyze, and refactor SQL fast with SQL Prompt

Writing SQL is 50% faster with SQL Prompt. Your SQL code can be formatted just the way you like it, you can create and share snippets with your team, and with code analysis you get suggestions to improve your SQL as you type. Download your free trial

Featured Contents

 

Streamline Log Shipping Failovers: DR Made Just For You…

Micah Nikkel from SQLServerCentral.com

A look at a SQL script solution that can help you easily fail over and back from log shipping scenarios. More »


 

Not So Forced Parameterization

Additional Articles from MSSQLTips.com

If you can't get forced parameterization to work due to variables, try using a temp table instead. More »


 

Review your SQL Server permissions with SQL Census (in preview)

SQL Census allows users to gain a clear picture of SQL Server access, from SQL roles and permissions to Active Directory account and group memberships. The tool provides a simplified view of these permissions, along with the path by which they were gained. There's more to come and you can help shape the future of the tool by joining the preview now. More »


 

From the SQLServerCentral Blogs - SQL Server Guide To NULL Handling

Gavin Draper from SQLServerCentral Blogs

Every language handles null equality differently and understanding this is crucial as a misunderstanding here can lead to some quite... More »


 

From the SQLServerCentral Blogs - Things I Learned at Summit v20 - Trace Flag 4199

Andy Galbraith from SQLServerCentral Blogs

Part of a series of posts on cool stuff I learned at PASS Summit v20 (2018) - in this first post... More »

Question of the Day

Today's Question (by Kendra.Little):

Which configuration changes the threshold at which statistics are automatically updated in SQL Server 2016 to a dynamic threshold based on the table's rowcount? (Rather than the old threshold of ~20% of the rows in the table.)

This question assumes that you have not enabled trace flag 2371.

Think you know the answer? Click here, and find out if you are right.


We keep track of your score to give you bragging rights against your peers.
This question is worth 1 point in this category: Configuration.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

ADVERTISEMENT

Extract, Transform, and Load with SQL Server Integration Services: With Microsoft SQL Server, Oracle, and IBM DB2

Readers will learn by example how to use Microsoft SQL Server 2016 Integration Services (SSIS) as they design and implement extract, transform, and load (ETL) solutions to support a business application that integrates with a data warehouse and an online Web store across a heterogeneous system. This volume describes proven methods to support common ETL needs, such as databases communicating directly with each other, using files to exchange data, or performing database operations using Web services.

Pick up your copy of this great book today at Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Kendra.Little):

Which of the following is TRUE about temporary tables used in stored procedures?

Answer: Statistics on temporary tables may be reused across multiple executions of the procedure

Explanation:

As crazy as it sounds, statistics on temp tables may be reused across multiple executions of the procedure. This is because, as Paul White, writes, “Statistics associated with a cached temporary object are also cached.” Read more in Paul’s article here: click here.

Using temp tables doesn't have to force a recompile on each run. They do support statistics. And they aren't always global... unless you make them global by naming them ##likethis.


» Discuss this question and answer on the forums

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.

SQL Server 2017 : SQL Server 2017 - Administration

Converting IO/s to MB/s - Hey everyone.  We are looking at replacing a physical server with a VM and want to do as much analysis...


SQL Server 2017 : SQL Server 2017 - Development

Help Writing SQL Query to extract information from table - Hello Community, I'm pretty new to this forum and SQL query. Can some please take a look at the attached table and...


SQL Server 2016 : SQL Server 2016 - Administration

SET PARTNER TIMEOUT mirroring - HELLO EVERYONE Who has an idea what exactly is this command for? ALTER DATABASE SET PARTNER TIMEOUT 30 thanks


SQL Server 2016 : SQL Server 2016 - Development and T-SQL

data - I have a column defined as col1  datetime2defaultcurrent_timestamp

Stumped trying to shred XML data into table rows - Hello experts, I have the following table: MyTable ( MyKey  varchar(100) not null primary key, ColXml varchar(max) null ) The ColXml column has xml data...

Importing from XML to SQL 2014 - This is my 4th day on SQL so I am a newbie. I created a query to import from an...


SQL Server 2014 : Development - SQL Server 2014

Interesting Use Case Of CEILING - I have ran into this while writing a reporting stored procedure.  I have found that CEILING will increase to the...

need help with logic, solution is nearly there, but one more hump - I don't know how to solve for Rule 5. An example of correctness is: 1Z3V1F0359168993, with one tracking_number sharing the same...


SQL Server 2012 : SQL Server 2012 - T-SQL

How can I combine the three queries to one and possibly improve performance - I wish I can get help from this forum, any suggestion is appreciated. I have a project with some existing sql...

Msg 512, Level 16, State 1, Procedure Rpt_RSQC_MRRFormSSRSSp, Line 261 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, , >= or when the subquery is used as an expression. - I am executing a SP and am getting this error: Msg 512, Level 16, State 1, Procedure Rpt_RSQC_MRRFormSSRSSp, Line 261 Subquery returned...

Need some help with some "XML Hell" please. - I'm working on an expansion of an incredible idea by Fabiano Amorimthat (https://blogfabiano.com/2012/07/03/statistics-used-in-a-cached-query-plan/) which uses Trace Flag 8666 to add...


SQL Server 2008 : SQL Server 2008 - General

Copying SSIS Packages from MSDB to a Windows folder - Hi, I need to get hundreds of SSIS Packages from the MSDB database out to a Windows folder. The only way...

SSIS drop table on spreadsheet - Hi There pls assist. I am trying to create a package that will query sql server and return results to excel,...


SQL Server 2008 : T-SQL (SS2K8)

Can it be improved again? - Hi there, I have want to modify a SP to select item's activities from a main table of 2 million...

SQL 2012 Trigger - If there is a new row in table ABC then it gets inserted into ABCtt as a result of the...


Reporting Services : SSRS 2012

Downgrade report from 2016 to 2012? - Is it possible to downgrade a report from SSRS 2016 to 2012?   There are a series of reports that were...


Programming : XML

Get all Attributes from this XML - Hi, how can i get a Resultlist (see below) from this XML? ------------------------------------------------------ DECLARE @x XML; SET @x   = N' <SessionStart xsi:noNamespaceSchemaLocation="http://www.itx.cc/psstart.xsd" sessionId="200" dateTime="2009-11-25T10:04:13.160"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  ...


Data Warehousing : Integration Services

SSIS Design Patterns and examples - Dear Forum, I was looking for a source / reference for SSIS Design Patterns and examples. e.g. some common designs for clone / re-use...


Data Warehousing : Strategies and Ideas

Using Hash values as Dimension Keys in Datawarehouse - All  We are exploring the idea of using a hash value as the surrogate key in Dimensions. Eg , Lets say we...


Career : Employers and Employees

Do recruiters primarily recruit for contract jobs? - I live in New Mexico (yes, we're part of the USA, despite opinions to the contrary). New Mexico is primarily...

This email has been sent to newsletter@newslettercollector.com. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com.
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com