If you come here regularly, you have probably noticed that my web site is not one that is updated frequently. Essentially, I make changes when I have a change to make: an update to an article, a new version of a tool or somesuch. If you want to see if I have any updates, this is the page you should bookmark. If I make additions to the site, or changes to existing items you will see it here. (Unless it's just a trivial fix like a correction of a spelling or a grammar error.)
Some minor additions to the articles How to Share Data Between Stored Procedures and Dynamic Search Conditions.
Uploaded pictures from a two-week trip to Madiera and Lisbon.
A couple or minor corrections and additions to my article Slow in the Application, Fast in SSMS?
Uploaded pictures from year just gone by, ranging from April to December. Summer pictures as well as shorter trips for SQL Saturday and alike.
Updated my SQL Server Wishlist to reflect that two wishes have been granted in SQL 2019.
A new small utility SearchCode to store your SQL code in a full-text index table so you can search it efficiently.
An update to the section Could it Be MARS? in the article Slow in the Application, Fast in SSMS? It seems that we now have answer to why MARS can slow things down - network latency.
Updates to the articles Dynamic Search Conditions and Arrays and Lists and SQL Server, both The Short Version and The Long Version. For all three articles the changes were prompted by the introduction of interleaved execution of multi-statement functions and CLR Strict Security in SQL 2017. I also made a few more changes to them while I was at it, as detailed in the Revision section of each article.
Updated the text on the -q option for BCP in the article Using the Bulk-Load Tools in SQL Server to reflect that this option has a second behaviour of which I was not previously aware.
A new version of sp_sqltrace with two fixes for wait-stats information.
Made a revision of Appendix 1 in the series Error and Transaction Handling in SQL Server to cover input from Robin Otte and other findings.
Reviewed all articles with regards to links to the defunkt Connect site and replaced them with links to the new Uservoice site, or simply removed the links. I have not made entries into the Revision History section for the articles where this was the only change. However, for three articles there were also smaller updates to the contents as a consquence of the review:
Updated my SQL Server Wishlist so that all links to point to the new feedback site on Uservoice. In the process, I reviewed the wishlist and added and removed a few. I also replaced Connect links in the articles Ideas for SET STRICT_CHECKS ON and Why Read-only Table Parameters is Not Enough and also reviewed the contents. Particularly, I introduced a new idea how to deal with temp tables with strict checks.
Alexey Guzev has been kind to provide a Russian translation of Part One of Error and Transaction Handling in SQL Server.
Released version 2.011 of Win32::SqlServer with support for Perl 5.26 and the new MSOLEDBSQL provider.
Made some updates to Part Two of Error and Transaction Handling in SQL Server prompted by input from Nick Reilingh.
I'm back from New Zealand and the full story with all pictures from the trip is now available and finalised.
Uploaded the first set of pictures of the trip I started in Singapore, and of which the main focus is New Zealand. I hope to upload pictures as the trip goes on. The last stop on the trip will be SQL Saturday in Victoria and the MVP Summit in Seattle, but don't expect pictures from these places.
Some small modifications to the article Packaging Permissions in Stored Procedures.
Uploaded a set of pictures I took in 2017 in Copenhagen, Wrocław, Oslo, Sofia, Seattle, Ljubljana. And of course there is regular set of summer pictures from the Stockholm area.
Three minor updates to the article Slow in the Application - Fast in SSMS.
Replaced the old article Granting Permissions through Stored Procedures with a new called Packaging Permissions in Stored Procedures. The topic is the same, but I wrote the article from scratch and the style of presentation is entirely different. Rather than long pieces of demo code, you get it piece by piece. The article is about 60 % long, and I believe the biggest reason is that I hold a slower pace, so that the material is easier to digest. There is also an appendix to the article, where I showcase the use of certificates in specific situations, including special situations like activation procedures for Service Broker, contained databases and letting users to start a job. Speaking of the latter: this was also covered in the old article which included a bad idea to solve this with a jump database owned by sa. Bad, because I suggested that you could not create a user to impersonate sa. I was wrong, and this is covered in the new article in the section about cross-database ownership chaining.
The URL for the new article is the same as the old.
Added a section Could it be MARS? to the article Slow in the Application - Fast in SSMS.
Added one more Connect item to the section Get the Call Stack in My SQL Server Wishlist.
The tenth public release of AbaPerls, label L1.0.0360.
Corrected an error in the section Finding Information About Statistics in the article Slow in the Application, Fast in SSMS? pointed out by Gordon Griffin. You can only use a column name as an argument to DBCC SHOW_STATISTICS if there is auto-created statistics on it.
A minor addition to the article Using Table-Valued Parameters in SQL Server and .NET to cover a performance gotcha when passing a DataTable as a parameter, as discussed in a blog post from SQL Server MVP Dan Guzman.
Uploaded a new version of the article How to Share Data Between Stored Procedures. It's a general overaul to keep up with the times, so that features introduced in SQL 2012 are no longer presented as "new, but there is also some new and revised content. See the Revision section for details.
Added a caveat about column names with spaces to the section Generating a Format File in the article Using the Bulk-Load Tools in SQL Server.
Added one Connect item for BEFORE triggers to my SQL Server Wishlist.
Released version 22 of beta_lockinfo. I'm making use of the new DMV sys.dm_exec_query_statistics_xml so it is possible to see actual plans from beta_lockinfo. This only concerns the version for SQL 2016, and it requires SP1 CU2.
Two updates to the series Error and Transaction Handling in SQL Server.
A minor correction to two scripts in the article Giving Permissions through Stored Procedures.
I'm now back in Stockholm after eight weeks in Argentina and Chile, and the collection of pictures from that trip is now complete and finalised.
Uploaded my first set of pictures from, my on-going trip in Argentina and Chile. I will hopefully upload pictures regularly during the trip, which lasts until the end of February. You need to watch this page for updates from the trip, because I will not announce each new set here.
Uploaded some pictures from Victoria, BC, Canada and Parma, Italy.
Changes to no less than three articles:
A fairly critical patch to Win32::SqlServer to address the problem that it not read the SQL Server version correctly when @@version includes information about CU or GDR. There is no version number, but the patch is labelled 2.010b, as it only affects the Perl part of the module.
Made an addition to the section Other Approaches in the chapter on administrative commands in Part 3 of the series Error and Transaction Handling in SQL Server that covers a solution from Dave Mason on the problem with trapping all error messages from commands like BACKUP/RESTORE.
A small correction to the article Dynamic Search Conditions: a NOT was missing in the code sample in the section Optional Tables for dynamic SQL.
Uploaded some summer pictures from Stockholm (and a few from elsewhere).
Add a new article to the web site: Using the Bulk-Load Tools in SQL Server, an article about how to use BCP, BULK INSERT and OPENROWSET(BULK) with a focus on function, that is how to use these tools with different formats – and also when they will not work for you.
Minor updates to the SQL Server Wishlist about auto-updated columns and built-in table of numbers.
Added a section Having XACT_ABORT ON by default? to Part Two of the Error and Transaction Handling series to discusses the new option in SSMS that permits you to do just that.
Rearranged and modernised the Arrays and Lists series. What used to be only a content listing is now a short introduction for people who need to know how to crack their comma-separated list. The article Arrays and Lists in SQL Server 2005 has been renamed to Arrays and Lists in SQL Server (The Long Version). I have added material on the new functions string_split and OPENJSON in SQL 2016 and made a general overhaul of the text to reflect that SQL 2005 is not really a new version any more. I have renamed the article Arrays and Lists in SQL Server 2008 to Using Table-Valued Parameters in SQL Server and .NET so that it better reflect the contents and decoupled it from the Arrays and Lists moniker. As a consequence of this, I have taken out some material that not directly related to TVPs. There are also some minor updates suggested by readers.
On a general note: there is now a Copyright notice on all articles on the site.
Released version 2.010 of Win32::SqlServer.
Put up pictures from my trip to the zone around Chernobyl power plant when I was in Kiev for SQL Saturday.
Updated my SQL Server Wishlist after the release of SQL 2016.
The release of SSMS 2016 has prompted an update to the section Line Numbers in SSMS in Part Two in the series Error and Transaction Handling in SQL Server.
Version 21 of beta_lockinfo. There are now four versions for different versions of SQL Server: SQL 2016, SQL 2012/14, SQL 2008 and SQL 2005. The version for SQL 2016 makes use of some new features in SQL 2016. Beware that if you upgrade from an earlier version of SQL Server and/or beta_lockinfo, you should drop any guest.beta_lockinfo as the table definition has changed. (Does not apply to earlier versions fo SQL Server.) For full information, see the Revision history.
One more small fix sp_sqltrace: it can now be created on a server with an SC collation.
Bugfix in sp_sqltrace: @snoop_time > 2147 resulted in an overflow error.
Somewhat belated, uploaded pictures from my vacation in Germany in the end of summer 2015, and a set of pictures which reaches from autumn to autumn in the Pacific Northwest with London and summer in Stockholm in between.
Geovanny Hernandez have been kind to translate Part One of Error and Transaction Handling in SQL Server into Spanish.
Some small corrections to the article Dynamic Search Conditions.
A couple of small updates to Parts Two and Part Three of Error and Transaction Handling in SQL Server prompted by the release of SQL 2014 SP1, the availabilty of SQL 2016 CTP2 and tips from the community.
Added Devart's ODBC driver to the page about accessing SQL Server from Unix.
Released version 2.009 of Win32::SqlServer. This version adds binaries for Perl 5.18 and 5.20. I am now supporting Strawberry Perl! I have dropped support for SQL Server 6.5 and Perl 5.8 and Perl 5.10.
Finally! Uploaded the three-part series Error and Transaction Handling in SQL Server. Part One is a short jumpstart which is for everyone. Part Two goes into detail what commands you can use for error and transaction handling how SQL Server can behave when an error occurs, a very bewildering topic. Part Three discusses how to implement error handling, and includes a facility, SqlEventLog to raise and log errors. Part Three also includes comprehensive examples for error handling. As the three parts should not be enough, there are also three appendixes: one for linked servers, one for the CLR and one for Service Broker. Start with Part One, and you will find links to the other articles. As part of the endeavour, I have also brushed up the old articles for SQL 2000, but mainly to make them fit stylistically with the other. Contentwise, they are largely the same.
Jim Higgins was very kind to point out a small but important error in the section on linked servers in the article on dynamic SQL. A missing dot rendered the recommendation incorrect.
Version 6 of sp_sqltrace. Wait-stats information now also includes external waits. That is, waits that are recorded because the process performs work outside SQL Server, for instance in an OS operation or accesses a linked server.
Version 19 of beta_lockinfo. Fixes for a potential overflow and a workaround for locked metadata in SQL 2014.
I have given the article on Dynamic Search Conditions on overhaul. The text have been reviewed from start to end, and there are some new content. I'm now giving examples with multi-valued parameters as well examples on how to handle dynamic sort columns. There is information about a new bug with OPTION (RECOMPILE) uncovered in the autumn of 2014. I've toned down the discussion on service packs and CUs for SQL 2008, since by now you should be on a later service pack – or have upgraded to SQL 2012/2014. Finally, I have relegated the older article for SQL 2005 and earlier to be a pure legacy article and it is on long directly visible from my home page.
Uploaded photos from my vacation in Ukraine and then there is also the traditional bag of summer pictures.
Version 18 of beta_lockinfo. Bugfix: beta_lockinfo would produce an overflow error if the instance had been up for 115 days or more. The format of the columns last_since and trn_since has been enhanced. Note that if you have used Archive Mode, you must drop the table guest.beta_lockinfo.
Version 16 of beta_lockinfo. Lots of changes. The biggest novelty is archive mode to permit you to save the output to a table. beta_lockinfo now also displays information about memory grants and locking partition. I've also taken measures to remove noise from the default output, for instance Service Broker process that are waiting for the next message to arrive are not displayed by default, as long as they hold no locks. See the revision section for a complete list.
Picture time again. Photos from my vacation the Carolinas and Georgia, as well as the regular set of summer pictures from Stockholm, this year extended thanks to a new camera with 50X zoom.
Updates to three articles:
There was a small error in the function setoptions that's attached to the article Slow in the Application, Fast in SSMS.
The ninth public release of AbaPerls. Lots of new features and improvements, start with the Compact History.
Added a new item to the SQL Server wishlist: Add a Virtual Errors Table.
Updated the article Slow in the Application, Fast in SSMS to reflect an import change in SQL 2012 SP1 with regards to the issue with linked servers. Also added a note to the section The Story so Far.
Added a good suggestion from Wayne Bloss about sharing temp tables in the article How to Share Data Between Stored Procedures.
Added a caveat to the documentation of the column tempdb in the output of beta_lockinfo. The procedure itself is unchanged.
A small update to the SQL Server Wishlist about the old Connect items with numbers in the 12xxxx range. They are visible, but you can currently not vote for these items.
Uploaded two suits of pictures: one from my vacation in Romania,where the top draw was the Danbue delta. Then there is a smaller suite with the regular pictures from summer in the area Stockholm, this time also augmented by pictures from Kalmar and Portland and a little more.
Added one more item to my Strict Checks proposal: columns must be prefixed by an alias or the table source when there are more than one table source visible, to avoid that adding a column in the future results in an ambiguity error.
There was a problem with some very old Connect items mentioned in my SQL Server wishlist. The Connect team have fixed this problem, and these Connect items should now be visible. (At least I can see them when I'm signed in, and I couldn't in the past.)
Version 15 of beta_lockinfo. Added display of non-default ANSI and locking settings as well a progress column (which applies to only some commands). beta_lockinfo now displays tasks without session ids that have interesting wait types. This can help you to see THREADPOOL waits that occurs when you run out of worker threads and your users cannot log in.
There is a new version of Lee Tudor's sp_sqltrace available. Lee have made a major overhaul and the procedure is now more powerful than ever. You can now snoop another spid instead of analysing your own process. The procedure now collects and presents wait-stats information per statement on SQL 2008 and up. There are several new parameters to control the procedure, and you can reanalyse a trace if you find that wanted to see the data in a different way. Finally, it has a new name, so you have it in master and run it from anywhere.
Released version 2.008 of Win32::SqlServer, an API to SQL Server for Perl. See the History file for changes and new features.
Corrected a few errors and mumblings in the paragraph about using the CLR for linked servers in the article How to Share Data Between Stored Procedures.
Rewrote most parts of the article Arrays and Lists in SQL Server 2008 Using Table-Valued Parameters. I found that was extremely easy to write a class that parses a comma-delimited string and feed the constructor of that class as the parameter value to a TVP, which is why I have replaced the previous examples with this one. I have also added two examples on how to load a file through a TVP, one non-streaming and one streaming example. I've also added information on how you can specify that the data you pass to the TVP is already sorted. As a consequenc, I have also updated the section on TVPs in the performance appendix, but I have not run any new performance tests.
Added a note about SQL Server Data Tools and sharing temp tables to the article How to Share Data Between Stored Procedures.
Updated my SQL Server Wishlist after the release of SQL 2012. I've rearranged the list, and I put focus even more robustness, devoting an entire section to wishes aimed to make development in SQL Server more robust. All new wishes on the wish list are in that area. I have also updated my document Ideas for SET STRICT_CHECKS ON with some interesting ideas for strict checks, for instance I suggest checks for cardinality errors at compile-time. I've withdrawn some wishes from the wishlist – those that were fulfilled and a few more. If you wonder what happened the old wishes, there is an annonated version of the old wishlist.
The eighth public release of AbaPerls. Big news! There is now support for Team Foundation Server. AbaPerls users can see the list of recent changes here.
Refreshed the article Connecting to MS SQL Server from Unix to reflect that Microsoft has released a CTP of an ODBC driver for Linux.
Several of the links in the section Further Reading in the article Slow in the Application, Fast in SSMS? were broken. This has been fixed.
Uploaded pictures from my vacation in Spain earlier this year, as well as the usual set of summer pictures from the Stockholm area (although you will need sturdy clothing to look at some of the pictures at the end, as they are from elsewhere.)
When I updated of the article article on Dynamic Search Conditions for SQL 2008 to reflect the release of SP1 of SQL 2008 R2, I missed in one place. This has now been corrected.
Released version 2.007 of Win32::SqlServer.
Updated the article on Dynamic Search Conditions for SQL 2008 to reflect the release of SP1 for SQL 2008 R2. I've also updated the script for Northgale to avoid use of some deprecated syntax and data types.
I've made a thorough revision of the article Granting Permissions through Stored Procedures. Partly this is due to that the article was originally written with SQL 2005 being a brand-new release which it no longer is. But I also cover some new ground with counter-signatures and show how you can use counter-signing to make it possible for plain users to start a certain job. The article now also includes a script to easily grant server-level permissions to a user-database procedure, using throw-away passwords for the certitficate. And the most important of all: the article includes a detailed discussion of what it means to make a database trustworthy, and how this can be a security vulnerability if done causually.
There is a now a Russian translation available of Slow in the Application, Fast in SSMS. Thanks to Dima Piliugin for this work!
Added section An Issue with Linked Servers to the article Slow in the Application, Fast in SSMS that covers one more reason why may see different performance in the application and from SSMS. Also, got a whim and clean up the article list one the home page to only include the date for the most recent revision of each article.
A minor update in the article on Dynamic SQL to reflect that the bug with OPTION(RECOMPILE) has been fixed. (It was over a year ago, but I had failed to update this article.)
Made an addition to the article Arrays and Lists in SQL Server 2008, Using Tabled-Valued Parameters: you need EXECUTE permission to use a table type.
Published a brand-new article: Slow in the Application, Fast in SSMS? Understanding Performance Mysteries, which takes its starting point in the confusing situation when a query is slow in your application, yet runs quickly when you investigate it in SQL Server Management Studio. In many of these situations parameter sniffing is part of the equation, and I explain what parameter sniffing is, and what measures you can take to avoid to be tripped by what in most situations is a good feature, but which sometimes backfires.
Uploaded a new version of beta_lockinfo. The new version displays temp tables with their logical name only. Moreover, if there is more than one temp table with the same name, they aggreagated into a single line per lock.
On a cold dark winter's day, what could be better than to dream back on the summer that was? Pictures from the summer of 2010 uploaded.
Imran Mohamed pointed out that there was an error in the article Granting Permission through Stored Procedures, the expression to decode context_info() would include trailing NUL characters in the character data. The expression has been improved.
I used to host a tool call Query Plan Tree, developed by Ivan Arjetinski. However, I have dropped this, since SQL Sentry have made their SQL Sentry Plan Explorer available for free. It has all the functionality of Ivan's tool and a lot more bells and whistles.
Released version 13 of beta_lockinfo. Bugfixes, and added a column to show tempdb usage.
Released version 2.006 of Win32::SqlServer.
The seventh public release of AbaPerls. AbaPerls users can see the list of recent changes here.
Updated the article Dynamic Search Conditions in SQL 2008 to reflect the release of Serivce Pack 2 for SQL 2008. Also, I have corrected a couple of grammar and spelling errors in the same articleDuff Browne was kind to point out.
I have rewritten the XML section in the article Arrays and Lists in SQL Server 2005. During the summer I became aware of several things about best practice and performance for XML, which I have addressed. I have performed a rerun of the performance tests for SQL 2008, since they were flawed in several aspects for XML. I have also uptaded the article for the original performance tests in 2006 to point out these flaws. I've also made some smaller updates to the section about fn_nums and added note that perforamance of INSERT VALUES with many rows may improve in SQL 11.
Updated the section on the OVER clause in the SQL Server Wishlist, with a new Connect item from Iztik Ben-Gan. Votes are encouraged!
Fixed an issue in sqltrace. Behzad Sadeghi pointed out that plans were missing for dynamic SQL invoked through sp_executesql. due to an inconsistency in SQL Server, which I have reported on Connect.With help of Behzad I have implemented a workaround for the issue.
Uploaded pictures from my spring vacation in the south of France and Paris. Also uploaded very old (and generally very poor) pictures from my vacation in 2000.
A new update for Dynamic Search Conditions in SQL 2008: There is now a Cumultative Update for SQL 2008 R2 which includes the fix for OPTION (RECOMPILE).
An update on the article for Dynamic Search Conditions in SQL 2008: the RTM version of SQL 2008 R2 does not include the fix to make OPTION (RECOMPILE) behave as desired.
Added a request for scoped variables to my SQL Server Wishlist.
Added a request for QUALIFY to permit for more concise queries to my SQL Server Wishlist.
Uploaded various pictures from 2009, mainly from summer in Stockholm and around.
Further changes to Arrays and Lists in SQL Server 2005 and Beyond, When TVPs Don't Cut it: some variations on fn_nums and some performance observations had I failed to include originally.
I've extended the section XML in the article How to Share Data Between Stored Procedures and made some other minor revisions to that article.
I've reworked the article on Arrays and Lists to cover a couple of new methods that people has to be kind to suggest to me. I've also run a new suite of performance tests on SQL 2008 to test the new methods together with the old ones. This time I have also tested call overhead, and made an attempt to test multi-thread performance. I've also added a new article for SQL 2008 that is devoted entirely to table-valued parameters. In total there are now three articles and two appendixes:
Two new items:
Started this web log, and added items back to 2009-04-01.
Updated the articles on Dynamic Search Conditions. With the release of SQL 2008 SP1 CU5, OPTION (RECOMPILE) now works like it did in RTM, but without the serious bug that caused Microsoft to revert to the old behaviour in SP1. Therefore I've restored the new article for SQL 2008, and the old one is again labelled to be for SQL 2005 and earlier.
In my SQL Server Wishlist, added request for getting the position in an XML document.
In the article How to Share Data Between Stored Procedures, added a brief discussion on performance about INSERT-EXEC with dynamic SQL, and a reference to a blog post from SQL Server MVP Adam Machanic.
Released version 12 of beta_lockinfo. I've added three columns to show information about the current transaction of the process. Also added one more spid column. I've also fixed textmode that was broken, and added better checks to the creation script to alert you when you don't meet the prerequisites.
Released version 2.005 of Win32::SqlServer.
Uploaded pictures from my trip to Japan.
The section on INSERT-EXEC in How to Share Data... said that it does not work with table variables, which is right on SQL 2000 only.
In the SQL Server wishlist, added an additional request with regards to domains.
Back to my home page.