Do you need to write a SQL Server query to find out which columns an index is on? Do you have an index name but need to use T-SQL to determine the column names? Not a problem! The query below will qive you exactly what you want. The example uses an AdventureWorks index as the […]
Looking to write a SQL query which will list out all the indexes in your database as well as the columns in the index? Well my friend you’ve come to the right place. The query below will give list out the following information: Schema Table Name (or view) Index Name Is Primary Key Is Unique […]
There are two different ways to perform a wildcard (aka LIKE) search in SQL Server to find a word with an “_” underscore. Both options are outlined at the end of the article after a reference to the cult classic Mystery Science Theater 3000: Escape From The Bronx.
I wish I could say this was my idea. Somebody posted it on twitter awhile back and I did the classic “facepalm”. I have no idea how many times I manually picked apart the results of SQL Server’s SET STATISTICS IO ON without considering creating a formula to handle it for me. So, somebody came […]
It’s out there. Waiting for you. While you sleep, it’s awake. It’s coming for you. It’s the Jason Voorhees of SQL Server and you’re the teenager headed into the woods on a dark night… How can you stay safe? Well my friend, knowledge is power. (For example, if you’re a teenager don’t go to Crystal […]
Listen up my people. NOT NULL columns are your friend. It may take a few extra brain cells to populate it initially but the long term rewards in data quality are well worth it. (You’ll also force all your software developer cohorts to think specifically about the values they’ll be inserting into a column which […]
Awhile, back I answered a LinkedIn question on version control for database objects. After continuing to use Visual Studio for Database projects for an additional four years since the original question was asked, my answer remains the same.
When deploying code I try to create my scripts so they can be rerun without an error being thrown (e.g. “object already exists”). There’s some fancy word for this that I used to try and use so as to appear ostentatious but it turns out people found me ostentatious even when I didn’t use the […]
Nooooooooo! Power outage+unsaved files SQL Server Management Studio files=Panic!!! Wait a sec. Don’t panic. Every modern application, especially Microsoft apps, prompts you after a crash and asks you if you want to recover your lost files right? Right!?! Somehow, SSMS does NOT include this feature. Why? No idea. Blame Management Studio’s stability. It rarely shutsdown […]
Warning! This post is barely finished. I putting it up as a reminder to myself that I had a hard time finding a post explaining how to do it and I should write a post on it. “It’s impossible” they said. “It can’t be done!” they claimed. “You’re mad (but still surprisingly handsome!)” the women […]