"SQL Spackle" is a collection of short articles written based on multiple requests for similar code. These short articles are NOT meant to be complete solutions. Rather, they are meant to "fill in the cracks". --Phil McCracken A frequent request found on the forums is to generate a comma-separated list of values, usually while maintaining other columns in a normal column list. The test data will contain 1000 account numbers, and 100 random 3 characters for each account.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Wayne Sheffield
Adding new files to a log-shipped database (SQL Spackle) – SQLServerCentral
“SQL Spackle” is a collection of short articles written to provide answers to specific, common problems or to explain particular methods, techniques, or tools. These short articles are NOT meant to be complete solutions. Rather, they are meant to “fill in the cracks”. --Phil McCracken Introduction Not so long ago, I ran into a problem that I thought worthy of writing about. A client had a small (4TB) database that was being log-shipped to a DR site.
Availability Group issues fixed with Alerts – SQLServerCentral
As I work with Availability Groups (AG), I’m amazed at what all SQL Server does behind the scenes to make them work… and to make them work fast and seamlessly. However, you still need to monitor them, and sometimes take corrective action. Wouldn’t it be great if you could have SQL Server take care of these Availability Group issues? This post will show you a couple of problems that I have seen, and solutions to automatically take care of those issues.
Using Google Chrome with SSRS – SQLServerCentral
I was recently working with a client with a SQL Server Reporting Services (SSRS) issue. Their company has standardized on using Google Chrome for the browser. However, they were running into issues when using Google Chrome with SSRS reports. The first issue was that they were receiving a log in prompt to the SSRS server when browsing to it. The second issue was the infamous Kerberos Double-Hop issue.
Understanding the OVER Clause in SQL Server – SQLServerCentral
The OVER clause was added to SQL Server “way back” in SQL Server 2005, and it was expanded upon in SQL Server 2012. It is used predominantly with the “Window Functions”; the sole exception being the sequence function NEXT VALUE FOR. The OVER clause is used to determine which rows from the query are applied to the function, what order they are evaluated in by that function, and when the function’s calculations should restart.
Splitting Strings in SQL Server 2016 – SQLServerCentral
While SQL Server 2016 hasn’t been released as of the time of this writing, it has entered into a Release Candidate state, currently RC0. One of the new features introduced in RC0 is the addition of the STRING_SPLIT function. This has resulted in the internet being abuzz with excitement about this function. This article will examine this function, including how it works, how it compares to other string splitting functions, and how it compares in performance to these other functions.
Having fun with PARSENAME (SQL Spackle) – SQLServerCentral
“SQL Spackle” is a collection of short articles written based on multiple requests for similar code. These short articles are NOT meant to be complete solutions. Rather, they are meant to “fill in the cracks”. --Phil McCracken Have you ever heard of the PARSENAME function? Have you ever used it? Is this something that you’ve added to your SQL toolbelt? If you’re like most people that I’ve met, then the answer to all of these would be “No”.
An Introduction to the SQLCMD Mode in SSMS (SQL Spackle) – SQLServerCentral
“SQL Spackle” is a collection of short articles written based on multiple requests for similar code. These short articles are NOT meant to be complete solutions. Rather, they are meant to “fill in the cracks”. --Phil McCracken Introduction I would venture to say that almost everyone reading this has heard of the SQLCMD utility and knows that it can be used to run T-SQL statements, system procedures and script files from a command prompt. Many of you have even used it.
The new Analytic functions in SQL Server 2012 – SQLServerCentral
The next version of SQL Server (v11.0), SQL Server 2012, is currently in a pre-release status known as RC0 (Release Candidate 0) from its former code-named “Denali” name. It is possible that the information in this article may change when this version is released to manufacturing (RTM). However the changes described in this article adhere to the ANSI specification, so I don’t expect to see any changes.
Transaction Isolation Levels – SQLServerCentral
I recently had the article Locking, Blocking and Deadlocking published here on SQL Server Central. This article is continuing from there and discusses Transaction Isolation Levels, and how the selection of a transaction isolation level affects the locking mechanism previously discussed in the earlier article.
Creating templates for use in BIDS (SQL Spackle) – SQLServerCentral
"SQL Spackle" is a collection of short articles written based on multiple requests for similar code. These short articles are NOT meant to be complete solutions. Rather, they are meant to "fill in the cracks". --Phil McCracken In Microsoft SQL Server 2005, Microsoft introduced the Business Intelligence Development Studio (BIDS) for working with SQL Server Reporting Services reports, and SQL Server Integration Services packages.
Locking, Blocking and Deadlocking – SQLServerCentral
I wish that I had a dollar for every time someone came to me, all excited and worried, telling me “We’ve got locking going on in this SQL Server instance”. My usual response is “Yep, we sure do. Isn’t it great?!” In this article, we’ll discuss locking in SQL Server, why it’s good, and what happens when it gets out of control. Locking is a mechanism built in to SQL Server in order to ensure transactional integrity and database consistency between concurrent transactions.
Loading XML Data into SQL Server (SQL Spackle) – SQLServerCentral
"SQL Spackle" is a collection of short articles written based on multiple requests for similar code. These short articles are NOT meant to be complete solutions. Rather, they are meant to "fill in the cracks". --Phil McCracken Introduction With XML becoming more and more the rage, DBAs are seeing many more requests to deal with XML data files. The question is: how do you load the data in the XML file into a table in SQL Server?
Comparing Table Variables with Temporary Tables – SQLServerCentral
There is a lot of confusion about what Table Variables are (and what they aren’t), and in how they compare to Temporary Tables. While there are a lot of articles on the internet about them, I haven’t found any that are complete. In this article, we’ll look into exactly what each are (and aren’t), and while we’re at it investigate some of the myths dealing with them, and see how accurate they are. Table Variables Table variables were first introduced in SQL 2000. So, what exactly is a table variable?
Performance Test of New Date Manipulation Functions (SQL Spackle) – SQLServerCentral
Introduction SQL Server 2012 introduces several new date/time functions that allow you to build a date/time from the individual parts of a date/time value. As I was experimenting with them, I was thinking that this is pretty neat, and bound to be very useful. And then I started wondering how well these functions performed. Before I had time to perform a test, I was working on something else where I needed to truncate a date/time value to the first day of the month.
The OVER Clause enhancements in SQL Server code named “Denali”, CTP3 – SQLServerCentral
The next version of SQL Server (v11.0), which at the time of the writing of this article is code-named “Denali”, was recently released as beta #3 (otherwise known as Community Technology Preview 3 (CTP3)). As you might expect from a new version of SQL Server, there are several new and enhanced features being added. This article is about the enhancements to the OVER clause and the different functions that can utilize it.
Setting SQL Server Default Locations – SQLServerCentral
SQL Server has default directory locations for where to place backups, data files, and log files. In the case of backups, this allows you to specify a backup with just a file name (from T-SQL), and the backup will go to this directory. When using the GUI tool, it will use this as the default directory. For data/log files, new databases will default to this location unless specified otherwise.
SQL Server Ranking Functions – SQLServerCentral
SQL Server 2005 introduced several new functions that belong to a group termed "Ranking Functions". In Books Online (BOL), Ranking Functions are described as “Ranking functions return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are nondeterministic.” The four ranking functions are ROW_NUMBER(), NTILE(), RANK() and DENSE_RANK().
Fixing DBCC CHECKDB Msg 8992 Errors – SQLServerCentral
This article discusses how to resolve two of the Msg 8992 errors encountered when running DBCC CHECKDB on a database that has been upgraded from SQL 2000 to SQL 2005. The two messages that will be covered are: Row in sys.columns does not have a matching row in sys.objects Attribute (parent_object_id) in sys.objects does not have a matching row in sys.objects. Both of these errors are because, in SQL 2000, one was allowed to directly modify system tables.
Automating Excel from SQL Server – SQLServerCentral
You get a new email… from your boss. It says: Hey Wayne. I get the data that's in the attached Excel spreadsheet from these 5 reports (which he then lists). Can you automate this so that this spreadsheet will be updated weekly with those values? Note that it needs to add new information to the end of the spreadsheet, not just replace the data. Oh yeah… can you have everything formatted like it currently is? When you look at the spreadsheet, there are many rows of data (one per week), and many columns.
Using XML to Enhance the Performance of String Manipulations – SQLServerCentral
String manipulation, especially with large strings, has always been a performance issue on Microsoft Windows operating systems. I was recently trouble-shooting a performance issue, and while doing so I learned some very useful methods where using XML can significantly improve performance during large string manipulations.
Using XML to pass Multi-Select parameters from SSRS to SQL Server – SQLServerCentral
When passing Multi-Select parameters from Reporting Services to SQL Server, the only way normally mentioned is to pass a comma-delimited string (built with the JOIN() VB function in SSRS) to SQL Server. However, you cannot use this parameter directly in a query, and must either use dynamic sql or utilize a process for converting this string into separate entries into a temp table. An alternative is to pass the Multi-Select parameter as an XML string.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Wayne
Contact Wayne, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack