There Is a Magic Button, a Rant

SQL Server, SQL Server 2016, T-SQL
OK guys. I think it's way past time. A bunch of us have been keeping a secret from the rest of you. We know something that you don't. I don't think we should hide this secret from the world any more. Illuminati? Incompetents. Free Masons? I am one, so I already know all those secrets. Bilderbergers, Cthulhu Cultists, MKUltra, New World Order, Rotarians? All of these are nothing compared to the vast conspiracy that I'm about to reveal. We need to just unveil the magic "Run Really Fast" button. We've been keeping that sucker a secret forever. It's been tough. Every so often some unauthorized person almost finds it or a "query tuning expert" (as if that was a real thing) tries to reveal it. But we've kept it secret…
Read More

Database Fundamentals #6: Create a Table with the SSMS GUI

Database Fundamentals
The whole idea behind databases is to store information, data, in order to look at it later. The place where that data is going to be kept is referred to as a table. A table consists of columns and each column can be defined to store a variety of specific kinds of data. You can make small tables or large ones. The columns on the tables can be made so that they have to have data in them or they can be empty. The choices are yours to make, but you need to know how to set tables up appropriately . In addition to tables, we're going to start learning about columns. Columns can be very generic in nature, supporting all sorts of different kinds of data, or they can be…
Read More

Database Fundamentals #5: Database Properties

Database Fundamentals
Don’t let the ease of creating databases lull you into a false sense of security. They actually can be very complicated. You can modify and individualize their behavior within your server so that different databases behave in radically different ways. The best way to see all the different manipulations you can make, open the New Database window by right clicking on the Databases folder within the Object Explorer window, assuming you’re already connected to the server. Don’t bother typing anything into the first page. Click on the Options tab on the left side of the window. You’ll see a screen that should look very similar to this: Don’t worry. We won’t be talking about all the possible settings on this page. Instead we’ll focus on a few that are extremely…
Read More

I Love Entity Framework

DevOps
I love Entity Framework. I also like (not love) nHibernate. That's right, as a DBA and data professional, I'm telling you I love Object/Relational Mapping tools (ORM). I think this is a technology set that the DBA needs to more tightly embrace. Let me tell you why. Most of the Queries I know that the biggest pushback against Entity Framework (EF) and it's fellow ORM tools is that they generate crap code. I know this to be true. I've seen it. ORM tools can, and do, generate seriously poor T-SQL. That's not to mention the N+1 problem and a few others. However, as you see from the article in that link, these problems and how to avoid them are very well defined. You don't have to suffer from the issues.…
Read More

Database Fundamentals #4: Create a Database

Database Fundamentals, T-SQL
SQL Server provides multiple ways to perform most functions. In order to maximize your understanding of how SQL Server works and have as many different mechanisms as possible for getting work done, you’ll use the GUI and TSQL to learn how to create and drop databases. You can then use whichever mechanism works best for you at the moment. Using  each method, we’ll first create a database using the least amount of work possible, just so you can see how easy it is create a database. We’ll go over how to remove databases from the system, getting rid of the database you just created. From there we’ll drill down to create another database, exploring some of the different mechanisms you can use to change how databases get created. Then we’ll…
Read More

Database Fundamentals #3: What’s In a Database?

Database Fundamentals
It’s worth noting that a lot of people will never need to create their own database. You may never create your own tables or other data structures either. You may only ever run backups and restores and manipulate the security on the system and let application installs create databases for you. That’s completely understandable and perfectly in line with the needs of many businesses and many accidental DBAs. However, it's a good idea to understand what this stuff is and how it works as part of understanding SQL Server. A Database Is Actually Files You need to store information that you want to be able to retrieve later. It’s necessary that you organize that information. If you were working with a word processing program, you store different documents in different…
Read More

The Three T’s of Backups

T-SQL
I just read several more horror stories that include, among other things, failed backups. I've said it before (at volume, extreme volume), and evidently I have to say it again. Simply creating a backup file is not enough to ensure the protection of your information. In order to attempt to reinforce the importance of this idea, I'm going to introduce a new concept. Maybe it'll help. I'm calling it "The Three T's of Backups." Take 'Em First, and most important, you have to Take backups. That's your first "T". No, disk redundancy through RAID or a SAN or some other setup is not adequate to protect your information. You must take backups. They have to be created and they have to be run regularly. You absolutely should automate this. Test…
Read More

Database Fundamentals #2: SQL Server Management Studio

Database Fundamentals
The best way to learn any software is to start using it. There are a bunch of software tools in the SQL Server toolbox, but the biggest and most important is SQL Server Management Studio (SSMS). SSMS is where you'll spend most of your time when you start to work with SQL Server. It provides a very large series of graphical user interfaces for creating databases, setting up security, reading data out of the database, and all sorts of other things within your SQL Server instances, the databases stored there, and all the stuff inside those databases. It also supplies you with an interface to the basic scripting language of SQL Server, through which you can do almost anything to the server. The scripting language is called Transact Structured Query…
Read More

T-SQL Tuesday #091 – Databases and DevOps

DevOps
Implementing DevOps with databases presents a unique set of challenges. However, just because something might be hard doesn't mean that it shouldn't be done. I had the opportunity to work with a team of developers, database developers and DBAs under a management team that all agreed on the common goal we had, delivering more, better performing applications, faster. We didn't know it at the time, but we were doing DevOps. DevOps gets a bad name because, well, the problems that DevOps sets out to solve, poor communication, bad teamwork, dysfunctional development and badly configured and maintained processes, are  done by the same team that attempts to implement DevOps. However, they look on it as a purely mechanical switch that they throw, assign some poor person to the role of DevOps…
Read More

Database Fundamentals #1: Install SQL Server

Database Fundamentals
To get started with SQL Server, you need to install it. However, I'm not going to teach you how to do a SQL Server install. Instead, I want to point you towards a couple of sources of information, and, give you some alternatives to installing SQL Server. Install SQL Server As much as I enjoy sharing information with you through this blog, and despite the fact that I read a lot of other technology blogs and other resources online, the single best source of information on SQL Server remains Microsoft and their SQL Server Documentation. This information is up to date and very well maintained. Yes, I'm sure you can find somethings to complain about in there, but overall, it's the starting point for all SQL Server learning and understanding.…
Read More