| A community of more than 1,600,000 database professionals and growing |
| | SQL Database Analysis Today we have a guest editorial as Steve is out of town. Static code analysis, an analysis of the code before the build, is much loved by IT managers, because it gives you a quality ‘metric’. It is often loved by development team leaders, because it will warn you if something is going to break the build. It is often used as a measure of ‘technical debt’. There are several tools for doing static code analysis of SQL code. This may seem slightly odd, because a SQL Server database is quite unlike C# or Java code. A SQL Server database is, by contrast, a complex dynamic system that will, if necessary, decide on an execution plan that is quite different to the SQL query that is presented to it. SQL queries on the system catalog allows you to explore database objects, their relationships and attributes, in the live system. You build your database, and then you analyse it. There are still plenty of objectives in a static analysis of the inert code that will build the database system. Although you can establish dependencies of routines such as functions or procedures from the live system, there is plenty of information that remains tantalisingly hidden: The use of unreliable code (such as IsNumeric); the presence of deprecated code where there is a better alternative; Excessive Cyclomatic complexity of code – I could go on, and have already done so. Dynamic code analysis via SQL misses out on all this information. I use static code analysis, especially in Continuous Integration before a build from source control: it would seem foolish to pass up such a rich source of information. However, there is so much more, and different, information about code and design to be gained once the build is successful. Suddenly, dependencies are easy to establish. The table smells are easier to detect, and you can quickly find the ‘god-like’ views and functions that bring database to their knees. You can check for obvious sins such as duplicate indexes or missing documentation. Then, of course, you give the database a workload and use system views such as DMVs to make sure that the database is handling correctly. I very much believe that a combination of static and dynamic code analysis can give you the best feel for the state of a database, particularly if you add in the results of analysis of the ‘instrumentation’ the various integration tests. You have a lot of metrics, and a number of pointers to where to concentrate the effort to improve delivery. Basically, there are fewer surprises: and in development surprises are generally unpleasant. Phil Factor from SQLServerCentral.comJoin the debate, and respond to today's editorial on the forums |
|
| ADVERTISEMENT | | Could you help with some research? The Foundry team at Redgate want to hear about your experience with SQL Server asset management. Fill in this short survey to help out, and also to enter their prize draw for a $100 Amazon gift card. Complete survey. |
| | NEW SQL Clone - version 1 available now! Create copies of production databases and SQL backups in seconds and save up to 99% of disk space using SQL Clone. Redgate’s new tool removes much of the time and resource needed to create and manage database copies, allowing teams to work on local environments to develop, test and diagnose issues faster. Try it free. |
|
|
|
| | | Additional Articles from SimpleTalk Dynamic Data Masking is a good way of rendering data unreadable for such purposes as user-acceptance testing, or demonstrating an application. It doesn't encrypt the data, and a knowledgeable SQL user can defeat it. However it provides a simple way to administer from the database what data the various users of a database application can and can not see, making it a useful tool for the developer. More » |
| Devin Knight from SQLServerCentral Blogs In this module you will learn how to use the SandDance Power BI Custom Visual. The SandDance visual is an... More » |
| Ryan Adams from SQLServerCentral Blogs In this video I talk about Trace Flag 1117 and how it was designed to help keep data file growth... More » |
|
|
| | Today's Question (by Henrico Bekker): Editor: I'm not really sure how to reword this. The question and structure doesn't really make sense. What will the outcome be when executing the below batch? USE [myDB] GO CREATE PROC [dbo].[usp_my_test_proc] as EXEC master..xp_CMDShell '"F:\Folder\Scripts\clearfoldercontent.bat"' GO exec [dbo].[usp_delete_validation] exec [dbo].[usp_export_Data] GO |
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. 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 | T-SQL Querying (Developer Reference) Squeeze maximum performance and efficiency from every T-SQL query you write or tune. Four leading experts take an in-depth look at T-SQL’s internal architecture and offer advanced practical techniques for optimizing response time and resource usage. Get your copy from Amazon today. | | |
|
|
|
|
|
| Yesterday's Question of the Day |
| Yesterday's Question (by Junior Galvão - MVP): There is no limit to the number of columns in the ORDER BY clause; however, the total size of the columns specified in an ORDER BY clause cannot exceed how many bytes: Answer: 8,060 bytes Explanation: The correct answer: 8.060 bytes. Explanation: There is no limit to the number of columns in the ORDER BY clause; however, the total size of the columns specified in an ORDER BY clause cannot exceed 8,060 bytes. Columns of type ntext, text, image, geography, geometry, and xml cannot be used in an ORDER BY clause. References: click here » Discuss this question and answer on the forums |
|
|
| | David Kranes from SQLServerCentral.com This script is great for determing index usage and whether they need to be tuned or dropped. It also provides you with the drop index DDL as well as the create index DDL, incase you need to recreate it for whatever reason. More » |
|
|
| Database Pros Who Need Your Help |
| Here's a few of the new posts today on the forums. To see more, visit the forums. Maintenance Plans Failing After SQL Server CU2 installed - I get the following error when a job executes our maintenance plan: Description: The Execute method on the task returned error... Syntax error - hi ..Can anyone tell me what is the error here. I tried closing the table and adding but it still... SSIS Data Profiling task The variable "User::Results" was not found in the Variables collection. The variable might not exist in the correct scope. - Hi folks I'm new to SSIS so apologies for the newbie question. I've been following this guide - https://www.simple-talk.com/sql/ssis/sql-server-2008-ssis (Quickly) Delete records from a table, with condition - Hello all, I'm supporting a database that I inherited so now having to handle some issues that are now arising. In... Loading Excel file through Sql Agent Job - Hello, I'm trying to load excel file into Sql server database using SSIS package. It runs fine, but when I create... which account to use for SQL Server Agent, Engine and Reporting Server - Dear MVPs I hope you guys are doing great I am installing a new instance of SQL Server 2012 standard... To Delete / Truncate / Drop & Create - Good Morning All, Can I Have some opinions please. Have 2 large tables I need to 'clean', 1 with 265263333 rows and one... Bug submission (Need feedback first) - SSMS "Undo" button removing lines from query - OK, I looked for this in these forums and various other places but found nothing. I almost ruined my query... SSIS ForEach Loop Container recursion question - I have a weird one today. Because my destination system can only accept files of a certain size, I need... weird string problem - In my table I have a string column that contains a string representation of a time. The field could contains... SQL Logical File names in GUI different than what's in the system databases - For some databases, I'm noticing discrepancies between the logical database file names that SQL Server is reporting in the GUI... How to get count of month and year month-wise and year-wise. - I have 3 tables: Country, Category and User tables: 1. 2. 3. Why would SQL throw a Severity 016 alert?? following a successful db restore? - Hi all, Does anyone know why would SQL throwing a Severity 016 alert following a successful db restore, and what I... Unable to open Step output file - Hi I am running sql script inside job.But sql is not saving the results in the file which i specified('Unable... SQL QUERY Rows where TotalScore=@TotalScore in the range of value by using group by Date and Time - Dear Expert, I am seeking your help . here is the scenario , please see the Figure -1 I have 3 parameters .1.... Dealing with programmers - Hi Community, Dealing with programmers turns to be a difficult challenge, when they ignore his duties, because they do not have... convert string YYYYMM into date SSIS - Hi new to SSIS , I am trying to convert a column "Date" in excel YYYYMM (Currently a string) into a date... Basic question about SQL Server permissions for users - Hello, I am on a bit of a learning curver and started looking at the security issues in my databases.... VS_NEEDSNEWMETADATA error - Hi, I am trying to run an SSIS package via a job. However, I get the below error: Started: 11:18:08 Error: 2011-08-17... Deferred Update - What are the different situations where we can see "deferred update". I am aware of "any column that is part... |
|
| This email has been sent to [email protected]. To be removed from this list, please click here. If you have any problems leaving the list, please contact the [email protected]. | 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 ©2017 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. Contact: [email protected] |
|
|