This months TSQL Tuesday subject is a shout out and high-five to those people who have inspired or made a contribution to my DBA life. So here goes: Before I started my career as a Database Administrator I worked in the motor trade for approx 12 years , I worked with some great people and gathered... Continue Reading →
UNDERCOVER TOOLBOX: Find Untrusted Foreign Keys and Orphaned Key data
SQL Server tracks untrusted Foreign keys in sys.Foreign keys with a column called is_not_trusted, there may be a number of reasons why a Foreign key may have become untrusted below are a couple of examples: Foreign key was disabled using the 'NOCHECK' option then re-enabled using 'CHECK' (not to be confused with 'WITH CHECK') Foreign key was... Continue Reading →
Joining Datasets Side by Side, in Their Natural Order When There’s No Common Key
Here's a little something that came up the other day, we've got a couple of tables which we need to join together but there's no common key to join on. How do we go about attacking this? As an example consider the following, we've got two comma delimited strings that we need to join together.... Continue Reading →
Generating Random Numbers For All Rows in a Query and Other Funky Stuff You Can Do With Them
UPDATE: Check out Generate a Random Number for Each Row in a Query {a better way} for an alternative method that I now use for generating random numbers using CRYPT_GEN_RANDOM Here's a lunchtime quickie for you all, this is something that I've seen asked on the forums plenty of times and always gets some quite... Continue Reading →
UNDERCOVER TOOLBOX: sp_FailedLogins, Capture those failed logins with ease.
Here is a relatively simple yet effective stored procedure to quickly view those failed login attempts (an alternative to viewing the SQL Server Error log manually and filtering). There are other ways of getting this information, but we liked the idea of having a stored procedure that we could run Ad hoc when we wanted. Its... Continue Reading →
UNDERCOVER TOOLBOX: fn_SplitString, It’s Like STRING_SPLIT But For Luddites (or those who haven’t moved to SQL 2016 yet).
When Microsoft announced STRING_SPLIT, cries of joy and jubilation could be heard all around the offices of SQL Undercover. For those of you who aren't aware of this miracle of the database world, we've finally got a way of converting a delimited string into a table. If you've ever written a proc or script where you... Continue Reading →
DBs in the Cloud Part 1 – Setting up and Connecting to a SQL Azure Database
Unless you've been living under a rock for the last few years I'm sure that you've all heard of that mystical world that is Azure and some of us may even know people who have visited that land but how do we get there ourselves? Well don't worry my fair database folk, there's no need... Continue Reading →
SQL Mirroring, Preserving the Log Chain During Database Migrations
Database mirroring has been deprecated since SQL Server version 2012 and now with the advent of SQL 2016 SP1 which happens to include two node Always On in Standard edition, surely there's no place in the World for it, right? Consider this scenario for a moment, you've got a 2TB database that lives on Server... Continue Reading →
