Category: SQL Server

2

SELECT COUNT(*) vs COUNT(1) vs COUNT(ColumnName)

What is the difference between COUNT(*), COUNT(1) and COUNT(ColumnName)? A mystery that will never be known… ok that was a lie, but the rest of this blog is not a lie, just to be clear.  🙂 COUNT(*) – Number of...

Reset Identity Column in SQL 0

Reset Identity Column in SQL

I’ll be honest, I am partially writing this because I always forget how to reset the identity column on a table and I want to be able to just pull up my blog and look it up.  Yet again today...

1

Query Table Metadata

There will inevitably come a day when you want to take a look at the metadata of the tables inside a database. This can be accomplished one of many ways, the quickest and easiest is to expand the columns node...

SQL Saturday Pensacola 0

SQL Saturday Pensacola

I know it has been almost a month since I posted last and this is not really a “real” post, but I assure you that new content is on the way.  I have a couple things in the works that...

Search Stored Procedure Text 7

Search Stored Procedure Text

There will come a day, if it has not already come and gone, when you will want to search through your stored procedures because you don’t remember which one did what you want to do.  Did that make sense?  Because...

Division: SQL Server Style 0

Division: SQL Server Style

When doing calculations in SQL Server queries it is important to know that anything without a decimal is going to be treated as an integer and therefore will cause the result to be an integer as well.  For instance, lets...

0

Query to Find Database and Log File Information

I have recently been dealing with a situation with a client where the transaction log has become an issue.  Naturally during the research portion of trying to figure out what is wrong I wanted to find things like the size...

Database Recovery Models 0

Database Recovery Models

Database recovery is a very important thing, especially to DBA’s, and the occasional developer who screws something up.  Please note, I am a developer and I would NEVER mess ANYTHING up in a database.  I treat all databases equally and with respect.  Anyway, we are getting off...

Query SQL Server Job Tables 1

Query SQL Server Job Tables

If you have ever wanted to query the SQL Server job tables then you know they are a little cryptic. The following query will assist you in getting some useful information out of those tables. I recently wanted to be...

Multiple CTEs in One Query 0

Multiple CTEs in One Query

CTEs are a great thing to use in your query.  They are an excellent way to consolidate code and make it readable as well as create a “view” inside of your code.  One great thing I have used them for...