Category: SQL Server

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...

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...

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...

0

Script Indexes With Your Tables

Scripting tables inside of SQL Server Management Studio is a very simple task.  Just right click and select script table.  The problem is that, but default, the indexes on a table are not part...

Select NULL AS Max or Min in SQL Query 4

Select NULL AS Max or Min in SQL Query

By default the functions MAX and MIN do not count NULL in their evaluation of your data.  If we have a column containing only dates for instance and there is a NULL date, MAX...

Truncating A Replicated Table 1

Truncating A Replicated Table

On a recent project that I was working on we came across an issue where we needed to replicate several databases on a new server.  Much of the ETL had places where tables were...

CREATE SCHEMA Syntax Error 0

CREATE SCHEMA Syntax Error

Recently while creating a script to migrate the new holding tables over to the stage and production machines I ran into a little issue.  The holding table we are using in this case houses...

Comma Delimited List with COALESCE 0

Comma Delimited List with COALESCE

There may be a day when you need to create your own comma delimited list from data contained in a SQL table.  Sure you could build a cursor and go through each row adding...