top of page
Search


A simple guide to drawing in SQL server using SSMS. A technical article.
tl;dr. Look for the SQL files here, https://github.com/SQLAdrian/drawingWithSSMS The premise is quite simple, to draw something in SSMS using the spatial results tab . The easiest way to do this is to pick an image and convert it into something that SQL Server can understand. My intent was, and still is, to provide you with some guidance on how to create your own image in SQL Server Management Studio, and I provide this further in this article. You will find this article r

sqldba
Oct 19, 20238 min read
Where did my [sys].[sp_dboption] go?
Well in SQL Server 2012, to be quite blunt, [sys].[sp_dboption] has been deprecated, dumped, canned or if you prefer, sent to Zim. Now isn’t that just dandy..because you will only realise this only when it is too late. But on the other hand Darren, you can always do a quick fix, all you need is an earlier flavour of SQL Server and some creative thinking. Open SSMS and explore your database in question. If you don’t find [sys].[sp_dboption], just grab it off a SQL 2008 Ser

sqldba
Jan 14, 20134 min read
SQL: what is this OPTION(OPTIMIZE FOR UNKNOWN)?
If you are into caching and reuse of existing query execution plans, which no doubt excites you as much as it does me, you probably use OPTION(OPTIMIZE FOR UNKNOWN) in most of your queries. If, however, you are not tickled by SQL performance optimization, shame on you, you might want to have a look at this to help make some of your queries run a bit smoother. You can read more about this at OPTIMIZE FOR UNKNOWN – a little known SQL Server 2008 feature , thanks Peter Scharlock

sqldba
Dec 6, 20123 min read
How long will SQL Database be IN RECOVERY
Your SQL Server just decided to throw its toys out of the cot and it was right slap bang in the middle of that big index rebuild you were doing, or that mighty transaction. Now you look to carry on where you left off and really hope nobody picked this up. The only problem is that in SSMS you see the database status as “IN RECOVERY”.. What? Luckily SQL server is smart, really smart and it can repair itself when it hit a big boo-boo. Which is all well and good, but nobody want

sqldba
Oct 30, 20122 min read
How far is that SQL backup?
Good question, and normally it gets accompanied with some shouting. We normally tend to stagger our workloads into something that resembles a lot of backups in a row and some smart index rebuilds followed by some more backups. But that is not really the point of this little post. I had a situation where I needed to do a “quick” backup on 500GB Database. Needless to say I wanted to tell everyone to bugger off my server for some time and I wanted to know exactly how long… ..‘C

sqldba
Oct 30, 20121 min read
SQL Query AD Distribution Lists Membership
Ever wanted to query your AD from SQL and then list all the members of your Distribution Lists? Because you can’t do it, sheesh, that was easy. There are some limitations in OPENQUERY which means you cannot query multi-value fields from SQL, but you can pull results from a specific Distribution lists. Well funny you should end up here then, because I have just the thing. Something like this would work to get members of a DL SELECT name FROM OPENQUERY( ADSI,'SELECT name, membe

sqldba
Jul 20, 20123 min read
Dynamic SQL: What you need to know
I use Dynamic SQL queries for everything.. yes even for buttering my bread and putting on my socks. Yes, there are some security risks when using Dynamic SQL, but I know the risks and manage the implementation on code very carefully. In most instances this relates to script I run to manage stuff or reports. Where to begin: 1. Erland Sommarskog, dude you have made my life so much easier with this post. I keep it open in my browser at all times. The depth of information with re

sqldba
May 7, 20121 min read
Execution Plan’s Plan A
So you want to make your life easier. You want a nice big whopping bonus. You want that dodgy admin who talks in korn shell to finally respect you because you can also script dammit.. Well you have come to the right place.Let’s get to the juicy bits. This script will show you: o Result Set 1: Shows you execution plans information, if you have high plan usage and lots of Adhoc queries consider changing to ‘optimize for ad hoc workloads’ o Result Set 2: Shows execution pla

sqldba
May 7, 20122 min read
Help! My server ate my SQL indexes
Not really, but it is a nice little title isn’t it. So you are looking for a quick fix for your indexes. Use this little script. Thanks to Brent Ozar and Clayton Kramer for your work on the script, I just chopped it a bit for our South African climate and added some other sections. It will show you suggested indexes for performance improvements, then show you unused indexes and then finally heaps. Edit: I changed the “ChangeIndexStatement” that gets generated to include a fil

sqldba
May 7, 20114 min read
bottom of page

