I want some Moore

Blog about stuff and things and stuff. Mostly about SQL server and .Net
posts - 226, comments - 2295, trackbacks - 33

My Links


Hi! My name is 
Mladen Prajdić  I'm from Slovenia and I'm currently working as a .Net (C#) and SQL Server developer.

I also speak at local user group meetings and conferences like SQLBits and NT Conference
Welcome to my blog.
SQL Server MVP

My Books

SQL Server MVP Deep Dives 2
The Red Gate Guide to SQL Server Team based Development Free e-book

My Blog Feed via Email
Follow MladenPrajdic on Twitter

Users Online: who's online

Article Categories


Post Categories

Cool software

Other Blogs

Other stuff

SQL stuff

Wednesday, March 28, 2018

SSMS Tools Pack 4.7 is out with new features (Expand SELECT *, Find Item in Object Explorer), and a few bug fixes

SQL Editor Plus
New: Expand SELECT * to show columns from the tables, views, UDFs, CTEs, etc used in your query.
New: Quickly find an object in Object Explorer by pressing F12. It works for tables, views, stored procedures and UDF's.
Improved: Run Statement at Cursor adds the option to run statement from start up to the cursor position.

Search Databases, Tables, Views Data
Search results are now displayed in the query window connected to the same database as they were run on.
A bug was fixed where it didn't show correct number of found values
if the searched value was in more than one column in same row.

Export to Excel
Numbers longer than 15 digits are now treated as text, because Excel auto-truncates them.

Run Custom Scripts
Custom scripts can now be marked as External and will be run in the Command Line.

Manage License Activations
You can now check your license details and number of activated machines by yourself.

You can download it here and hope you enjoy it.

posted @ Wednesday, March 28, 2018 10:25 AM | Feedback (0) | Filed Under [ SQL Server SSMS Tools Pack ]

Wednesday, October 11, 2017

SSMS Tools Pack 4.5 is out with full support for SSMS 17 and various feature improvements.

Full support for SSMS 17
All reported issues during the beta support have been resolved.

Connection Coloring
Connection Coloring is now improved by coloring the server/database in Object Explorer as well.
This way you can always see if you're working on the correct server/database.

SQL Editor Plus
Auto-rename window tab text has been extended with option to rename the tab to
either the first line in the executed T-SQL script or the next non-empty line after
the user-set line in the executed T-SQL script if the user-set line is empty.

Export to Excel
Full support for correctly exporting Unicode characters not in extended ASCII set into an Excel file.

CRUD Generator
Update stored procedure is NOT generated if there are no updateable columns in the table.

You can download it here and hope you enjoy it.

posted @ Wednesday, October 11, 2017 11:21 AM | Feedback (0) | Filed Under [ SQL Server SSMS Tools Pack ]

Monday, November 28, 2016

SSMS Tools Pack 4.2 is out with beta support for SSMS 17 RC1, new features and minor bug fixes.

Beta support for SSMS 2017 RC1
Beta support for SSMS 17 RC1. Due to beta status this might have various bugs. Since SSMS 17 RC1 has just been released and is not recommended for production use the SSMS Tools Pack
for it might run into various issues as well. They will be worked out as the SSMS 17 gets more stable.

SQL Editor Plus
New Run At element in query window status bar with starting time of the executed query.
Auto-rename window tab text to the Nth (user-defined) line in the executed SQL script.
Automatically connect to the database with the same name when switching servers.

SQL History
Tab Sessions UI improvements when scrolling through items.

Export to Excel
Export folder defaults to %AppData%\SSMSToolsPack.

Other Minor Features
On first run the settings are imported from the last automated backup if it exists.

You can download it here and hope you enjoy it.

posted @ Monday, November 28, 2016 9:40 AM | Feedback (0) | Filed Under [ SQL Server SSMS Tools Pack ]

Wednesday, June 15, 2016

SSMS Tools Pack 4.0 is out. Full support for SSMS 2016 RTM.

Full support for SSMS 2016 RTM which came out June 1st 2016.

This new release brings the following feature improvements:

SQL Editor Plus
Renamed tabs get the custom name stored and properly restored in the SQL History's Tab Session.

Global Replacement Texts
Now you can have nested replacement texts that are properly evaluated up to 10 levels deep.

Insert Statements Generator
It can now also script views. Added an option to add column names to each scripted SELECT statement.

Export to Excel
It can now also export views to Excel.

You can download it here and hope you enjoy it.

posted @ Wednesday, June 15, 2016 2:36 PM | Feedback (3) | Filed Under [ SQL Server SSMS Tools Pack ]

Tuesday, March 29, 2016

SSMS Tools Pack 3.8 is out. New Excel Export feature, support for SSMS 2016 RC1 and various feature improvements.

This new release brings the following new features and feature improvements:

Export to Excel:
Properly export result sets, one or multiple tables or the whole database to Excel files. This feature doesn't need Excel installed to work. It correctly converts SQL Server data types to Excel data types, supports exporting unlimited table rows and creates a valid XLSX file.

Window Connection Coloring:
Custom text can now be set inside the colored bar for each server/database.

SQL Snippets:
Exporting and importing SQL snippets has been improved with snippet selection. You can now choose which snippets to export/import. This gives extra customizable flexibility.

SQL Editor Plus:
The Accidental Data Destruction Protector can now ignore temporary tables.

Default Settings Deploy:
Default Settings Deploy now auto-detects and auto-deploys new centrally created settings file.

Support for SSMS 2016 RC1:
With each new SSMS 2016 version the compatibility might break. The next update will be for the fully released SSMS 2016.

You can download it here and hope you enjoy it.

posted @ Tuesday, March 29, 2016 11:51 AM | Feedback (1) | Filed Under [ SQL Server SSMS Tools Pack ]

Thursday, October 08, 2015

SSMS Tools Pack 3.6 is out with support for SSMS 2016 CTP's and new database data search.

This new feature brings the following improvements:

Support for SSMS 2016 CTP 2.3 and up:
With each new SSMS 2016 CTP the compatibility might break. Future updates will come as soon as possible.

Search Database/Table Data:
Completely new Search dialog with the ability to filter on table names, column names and column data type groups.

You can download it here and hope you enjoy it.

posted @ Thursday, October 08, 2015 12:05 AM | Feedback (0) | Filed Under [ SQL Server SSMS Tools Pack ]

Sunday, May 03, 2015

SSMS Tools Pack is out with a NEW feature, a few improved features and various bug fixes.

The new feature is called Global Replacement Texts.
It gives you the ability to add custom replacement texts to your scripts in four different features.

Licensing now gives you the ability to upgrade your existing license from the previous major version.
This upgrade path is around 30% cheaper than buying a completely new license.

SQL Editor Plus has been extended with 2 new functionalities:
- Rename Window Tab by right clicking on your window's tab.
- Data Destruction Protector now protects against accidental DROP TABLE.

SQL History has a bug fixed that it didn't save on every interval when using Save to Database functionality.

Search Database Data now has column type choice like search through all textual or numeric columns, etc.

Other Minor Features have been improved like:
- Easier distribution of pre-configured add-in settings to new users with Default Settings Deploy.
- Full compatibility with built-in accessibility color schemes for visually impaired.
- Increased stability.

Hope you enjoy it.

posted @ Monday, May 04, 2015 3:00 AM | Feedback (4) | Filed Under [ SQL Server SSMS Tools Pack ]

Tuesday, May 20, 2014

SSMS Tools Pack 3.0 is out. Full SSMS 2014 support and improved features.

With version 3.0 the SSMS 2014 is fully supported.
Since this is a new major version you'll eventually need a new license. Please check the EULA to see when.

As a thank you for your patience with this release, everyone that bought
the SSMS Tools Pack after April 1st, the release date of SQL Server 2014, will receive a free upgrade
You won't have to do anything for this to take effect.

First thing you'll notice is that the UI has been completely changed.
It's more in line with SSMS and looks less web-like.
Also the core has been updated and rewritten in some places to be better suited for future features.

Major improvements for this release are:

Window Connection Coloring
Something a lot of people have asked me over the last 2 years is if there's a way
to color the tab of the window itself. I'm very glad to say that now it is.
In SSMS 2012 and higher the actual query window tab is also colored at the top border
with the same color as the already existing strip making it much easier to see to which
server your query window is connected to even when a window is not focused.
To make it even better, you can not also specify the desired color based on the database name
and not just the server name. This makes is useful for production environments where you
need to be careful in which database you run your queries in.

Format SQL
The format SQL core was rewritten so it'll be easier to improve it in future versions.
New improvement is the ability to terminate SQL statements with semicolons.
This is available only in SSMS 2012 and up.

Execution Plan Analyzer
A big request was to implement the Problems and Solutions tooltip as a window
that you can copy the text from. This is now available. You can move the window around
and copy text from it. It's a small improvement but better stuff will come.

SQL History
Current Window History has been improved with faster search and now also shows
the color of the server/database it was ran against. This is very helpful if you change
your connection in the same query window making it clear which server/database you ran query on.
The option to Force Save the history has been added. This is a menu item that flushes
the execution and tab content history save buffers to disk.

SQL Snippets
Added an option to generate snippet from selected SQL text on right click menu.

Run script on multiple databases
Configurable database groups that you can save and reuse were added.
You can create groups of preselected databases to choose from for each server.
This makes repetitive tasks much easier

New small team licensing option
A lot of requests came in for 1 computer, Unlimited VMs option so now it's here.
Hope it serves you well.

posted @ Tuesday, May 20, 2014 12:04 AM | Feedback (6) | Filed Under [ .Net SQL Server SSMS Tools Pack ]

Friday, January 10, 2014

Simple Merging Of PDF Documents with iTextSharp

As we were working on our first SQL Saturday in Slovenia, we came to a point when we had to print out the so-called SpeedPASS's for attendees. This SpeedPASS file is a PDF and contains thier raffle, lunch and admission tickets.

The problem is we have to download one PDF per attendee and print that out. And printing more than 10 docs at once is a pain. So I decided to make a little console app that would merge multiple PDF files into a single file that would be much easier to print. I used an open source PDF manipulation library called iTextSharp version

This is a console program I used. It’s brilliantly named MergeSpeedPASS. It only has two methods and is really short. Don't let the name fool you It can be used to merge any PDF files.

The first parameter is the name of the target PDF file that will be created.
The second parameter is the directory containing PDF files to be merged into a single file.

using iTextSharp.text;
using iTextSharp.text.pdf;
using System;
using System.IO;

namespace MergeSpeedPASS
    class Program
        static void Main(string[] args)
            if (args.Length == 0 || args[0] == "-h" || args[0] == "/h")
                Console.WriteLine("Welcome to MergeSpeedPASS. Created by Mladen Prajdic. Uses iTextSharp");
                Console.WriteLine("Tool to create a single SpeedPASS PDF from all downloaded generated PDFs.");
                Console.WriteLine("Example: MergeSpeedPASS.exe targetFileName sourceDir");
                Console.WriteLine("         targetFileName = name of the new merged PDF file. Must include .pdf extension.");
                Console.WriteLine("         sourceDir      = path to the dir containing downloaded attendee SpeedPASS PDFs");
                Console.WriteLine(@"Example: MergeSpeedPASS.exe MergedSpeedPASS.pdf d:\Downloads\SQLSaturdaySpeedPASSFiles");
            else if (args.Length == 2)
                CreateMergedPDF(args[0], args[1]);

            Console.WriteLine("Press any key to exit...");

        static void CreateMergedPDF(string targetPDF, string sourceDir)
            using (FileStream stream = new FileStream(targetPDF, FileMode.Create))
                Document pdfDoc = new Document(PageSize.A4);
                PdfCopy pdf = new PdfCopy(pdfDoc, stream);
                var files = Directory.GetFiles(sourceDir);
                Console.WriteLine("Merging files count: " + files.Length);
                int i = 1;
                foreach (string file in files)
                    Console.WriteLine(i + ". Adding: " + file);
                    pdf.AddDocument(new PdfReader(file));

                if (pdfDoc != null)

                Console.WriteLine("SpeedPASS PDF merge complete.");

Hope it helps you and have fun.

posted @ Friday, January 10, 2014 7:38 PM | Feedback (1) | Filed Under [ .Net SQL Server ]

Tuesday, July 02, 2013

SSMS Tools Pack 2.7 is released. New website, improved licensing and features.

New website
Nice, isn't it? Cleaner, simpler, better looking and more modern.
If you have any suggestions for further improvements I'd be glad to hear them.

Simpler licensing
With SSMS tools Pack 2.7 the licensing is finally where it should be.
It is now based on the activate/deactivate model.
This way you can move a license from machine to machine with simple deactivation on one and
reactivation on another machine. Much better, no?
Because of very good feedback I have added an option for 6 machines and lowered the 4 machines option to 3 machines.
This should make it much simpler for you to choose the right option for yourself.

Improved features
Version 2.5.3 was already extremely stable and 2.7 continues with that tradition.
Because of that I could fully focus on features and why 3.0 will rock even more that 2.7! ;)
In version 2.7 I have addressed quite a few improvements you were requesting for a while now.

SQL History
This is probably the biggest time saver out there, therefore it's only fair it gets a few important updates.
  • If you have an existing .sql file opened, the Window Content History now saves your code
    to that existing file and also makes a backup in the SQL History log default location.
    Search is still done through the SQL History log but the Tab Sessions Restore opens your existing .sql file.
    This way you don't have to remember to save your existing files by yourself anymore.
  • A bug when you couldn't search properly if you copied the log files to a new location was fixed.
    Unfortunately this removed the option to filter a search with the time component.
    The smallest search interval is now one day.
  • The SSMS Tools Pack now remembers the visibility of the Current Window History window when you exit SSMS.

SQL Snippets
You can now set the position of the cursor in your snippets by placing {C} somewhere in your snippet.
It's a small improvement but can be a huge time saver since you don't have to move through
the snippet to the desired location anymore.

Run script on multiple databases
Database choices can now be saved with a name and then loaded again next time.
You can also choose to run the script in a new window for each chosen database.

Search through grid results
You can now go previous/next search result with the Prev/Next control inside the search window.
This is extremely useful if you have a large resultset. IT saves you the scrolling.

CRUD generator
Four new variables have been added:
  • |CurrentDate| writes current date in format yyyy-MM-dd to your script
  • |CurrentTime| writes current time in 24h format HH:mm:ss to your script
  • |CurrentWinUser| writes current Windows logged on user to your script
  • |CurrentSqlUser| writes current SQL logged on login to your script
This was actually quite a requested feature so if you have any other ideas for extra variables, do let me know.

That's about it. I hope you're going to enjoy this version as much as the previous ones.
Have fun!

posted @ Tuesday, July 02, 2013 4:52 PM | Feedback (3) |

Monday, March 18, 2013

SQL Server: Writing CASE expressions properly when NULLs are involved

We’ve all written a CASE expression (yes, it’s an expression and not a statement) or two every now and then. But did you know there are actually 2 formats you can write the CASE expression in? This actually bit me when I was trying to add some new functionality to an old stored procedure. In some rare cases the stored procedure just didn’t work correctly. After a quick look it turned out to be a CASE expression problem when dealing with NULLS.

In the first format we make simple “equals to” comparisons to a value:

WHEN <equals this value> THEN <return this>

WHEN <equals this value> THEN <return this>
-- ... more WHEN's here
ELSE <return this>

Second format is much more flexible since it allows for complex conditions. USE THIS ONE!

WHEN <value> <compared to> <value> THEN <return this>
WHEN <value> <compared to> <value> THEN <return this>
-- ... more WHEN's here
ELSE <return this>

Now that we know both formats and you know which to use (the second one if that hasn’t been clear enough) here’s an example how the first format WILL make your evaluation logic WRONG.

Run the following code for different values of @i. Just comment out any 2 out of 3 “SELECT @i =” statements.

SELECT  @i = -1 -- first result
SELECT  @i = 55 -- second result
SELECT  @i = NULL -- third result

SELECT @i AS OriginalValue,

-- first CASE format. DON'T USE THIS!
WHEN -1 THEN '-1'
ELSE 'We landed in ELSE'
END AS DontUseThisCaseFormatValue,

-- second CASE format. USE THIS!
WHEN @i = -1 THEN '-1'
WHEN @i IS NULL THEN 'We have a NULL!'
ELSE 'We landed in ELSE'
END AS UseThisCaseFormatValue

When the value of @i is –1 everything works as expected, since both formats go into the –1 WHEN branch.


When the value of @i is 55 everything again works as expected, since both formats go into the ELSE branch.


When the value of @i is NULL the problems become evident. The first format doesn’t go into the WHEN NULL branch because it makes an equality comparison between two NULLs.
Because a NULL is an unknown value: NULL = NULL is false. That is why the first format goes into the ELSE Branch but the second format correctly handles the proper IS NULL comparison.



Please use the second more explicit format. Your future self will be very grateful to you when he doesn’t have to discover these kinds of bugs.

posted @ Monday, March 18, 2013 9:55 PM | Feedback (7) | Filed Under [ SQL Server Back to Basics ]

Wednesday, February 13, 2013

Few events I’m speaking at in early 2013

2013 has started great and the SQL community is already brimming with events. At some of these events you can come say hi. I’ll be glad you do!

These are the events with dates and locations that I know I’ll be speaking at so far.


February 16th: SQL Saturday #198 - Vancouver, Canada

The session I’ll present in Vancouver is

SQL Impossible: Restoring/Undeleting a table

Yes, you read the title right. No, it's not about the usual "one table per partition" and "restore full backup then copy the data over" methods. No, there are no 3rd party tools involved. Just you and your SQL Server. Yes, it's crazy. No, it's not for production purposes. And yes, that's why it's so much fun. Prepare to dive into the world of data pages, log records, deletes, truncates and backups and how it all works together to get your table back from the endless void. Want to know more? Come and see!

This is an advanced level session where we’ll dive into the internals of data pages, transaction log records and page restores.


March 8th-9th: SQL Saturday #194 - Exeter, UK

In Exeter I’ll be presenting twice.

On the first day I’ll have a full day precon titled:

From SQL Traces to Extended Events - The next big switch

This pre-con will give you insight into both of the current tracing technologies in SQL Server. The old SQL Trace which has served us well over the past 10 or so years is on its way out because the overhead and details it produces are no longer enough to deal with today's loads. The new Extended Events are a new lightweight tracing mechanism built directly into the SQLOS thus giving us information SQL Trace just couldn't. They were designed and built with performance in mind and it shows. The new Extended Events are a new lightweight tracing mechanism built directly into the SQLOS thus giving us information SQL Trace just couldn't. They were designed and built with performance in mind and it shows. Mastering Extended Events requires learning at least one new skill: XML querying.

The second session I’ll have on Saturday titled:

SQL Injection from website to SQL Server

SQL Injection is still one of the biggest reasons various websites and applications get hacked. The solution as everyone tells us is simple. Use SQL parameters. But is that enough? In this session we'll look at how would an attacker go about using SQL Injection to gain access to your database, see its schema and data, take over the server, upload files and do various other mischief on your domain.

This is a fun session that always brings out a few laughs in the audience because they didn’t realize what can be done.


April 23rd-25th: NTK conference - Bled, Slovenia (Slovenian website only)

This is a conference with history. This year marks its 18th year running.

It’s a relatively large IT conference that focuses on various Microsoft technologies like .Net, Azure, SQL Server, Exchange, Security, etc…

The main session’s language is Slovenian but this is slowly changing so it’s becoming more interesting for foreign attendees. This year it’s happening in the beautiful town of Bled in the Alps. The scenery alone is worth the visit, wouldn’t you agree?

And this year there are quite a few well known speakers present!

Session title isn’t known yet.




May 2nd-4th: SQL Bits XI – Nottingham, UK

SQL Bits is the largest SQL Server conference in Europe. It’s a 3 day conference with top speakers and content all dedicated to SQL Server.

The session I’ll present here is an hour long version of the precon I’ll give in Exeter.

From SQL Traces to Extended Events - The next big switch

The session description is the same as for the Exeter precon but we'll focus more on how the Extended Events work with only a brief overview of old SQL Trace architecture.

posted @ Wednesday, February 13, 2013 1:34 AM | Feedback (0) | Filed Under [ .Net SQL Server ]

Friday, December 14, 2012

SSMS Tools Pack 2.5.3 is out with bug fixes and improved licensing

Licensing for SSMS Tools Pack 2.5 has been quite a hit and I received some awesome feedback.
The version 2.5.3 contains a few bug fixes and desired licensing improvements.
Changes include more licensing options, prices in Euros because of book keeping reasons (don't you just love those :))
and generally easier purchase and licensing process for users.

Licensing now offers four options:

Per machine license. (€25)
Perfect if you do all your work from a single machine.
Plus one OS reinstall activation.

Personal license (€75)
Up to 4 machine activations.
Plus 2 OS reinstall activations and
any number of virtual machine activations.

Team license (€240)
Up to 10 machine activations.
Plus 4 OS reinstall activations and
any number of virtual machine activations.

Enterprise license (€350+)
For more than 10 machine activations
any number of virtual machine activations.

30 days license.
Time based demo license bound to a machine.

You can view all the details on the Licensing page .

If you want to receive email notifications when new version of SSMS Tools Pack is out you can do that on the Main page or on the Download page .

Version 2.7 is expected in the first half of February and won't support SSMS 2005 and 2005 Express anymore.

Enjoy it!

posted @ Friday, December 14, 2012 1:42 PM | Feedback (0) |

Monday, September 17, 2012

SSMS Tools Pack 2.5 is out. Added support for SQL Server 2012.

Because I wanted to make SSMS Tools Pack as solid as possible for SSMS 2012 there are no new features only bug fixes and speed improvements.

I am planning new awesome features for the next version so be on the lookout.

The biggest change is that SSMS Tools Pack for SSMS 2012 is no longer free. For previous SSMS versions it is still free.

Licensing now offers following options:

Per machine license. ($29.99)
Perfect if you do all your work from a single machine.
This license is valid per major release of SSMS Tools Pack
(e.g. v2.x, v3.x, v4.x).

Fully transferable license valid for 3 months. ($99.99)
Perfect for work across many machines.
It's not bound to a machine or an SSMS Tools Pack version.

30 days license.
Time based demo license bound to a machine.

You can view all the details on the Licensing page.

If you want to receive email notifications when new version of SSMS Tools Pack is out you can do that on the Main page or on the Download page.

This is also the last version to support SSMS 2005 and 2005 Express.

Enjoy it!

posted @ Monday, September 17, 2012 9:57 PM | Feedback (3) |

Thursday, December 01, 2011

SSMS Tools Pack 2.1.0 is out. Added support for SQL Server 2012 RC0.

This version adds support for SQL Server 2012 RC0 and fixes a few bugs with SQL History.

Because of the support for regions in SSMS 2012 the regions and debug sections feature has been removed from SSMS Tools Pack for SQL Server 2012.

The feature is still available for previous SSMS versions.

In other news SSMS Tools Pack has won the SQL Magazine bronze award for best free tool of 2011. You can view all the details at the SQL Server Magazine Award page.

Thanx to all the people who voted for it. I'm glad you all like it and use it with great success.

Also I've added a possibility for you to subscribe to email notifications in case the auto-updater doesn't work for you for some reason like being behind a proxy.

Enjoy it!

posted @ Thursday, December 01, 2011 8:34 PM | Feedback (0) | Filed Under [ SQL Server SSMS Tools Pack ]

Powered by:
Powered By Subtext Powered By ASP.NET