Author Archives: Matt

Database Size Calculations

This post falls firmly in the category of blocking and tackling, but is a question we all have to answer from time to time: “How big is this database?” Two methods: SELECT     DB_NAME(database_id) AS DatabaseName   , Name … Continue reading

Posted in SQL Server Development, SQL Toolbox | Leave a comment

DQS Services in Denali

Interesting article about the upcoming Data Quality Services feature in Denali. It’s worth mentioning, as it’s very similar to the Data Quality Control system that I developed (with a little inspiration from my friend) for our current data mart. In … Continue reading

Posted in Uncategorized | Leave a comment

XML Schema Creation in SQL Server 2005

Here’s an interesting approach for creating a quick and dirty schema to get you started with XML. DECLARE @schema xml SET @schema = (SELECT * FROM schema.TABLE FOR XML AUTO, ELEMENTS, XMLSCHEMA(’SchemaName’)) SELECT @schema I don’t have the source, but … Continue reading

Posted in SQL Toolbox | Tagged , , | Leave a comment

T-SQL Alter Statement Quirk

To answer a recent question to the PSSUG user group e-mail, I put together a post instead of trying to answer via e-mail. First, the question: I have a staging table. Stage_id identity Stage_File_Name nvarchar(100) AllData nvarchar(max) I load a … Continue reading

Posted in Uncategorized | Leave a comment

Recursive Directory Scripting

Inside source control, I have scripts arranged as follows: Drive:/Base/Database/ Drive:/Base/Database/Functions Drive:/Base/Database/Proc Drive:/Base/Database/Tables Etc.. Each script stored can be run multiple times with no ill effect. For example, a table generation script first checks to see that it exists before … Continue reading

Posted in SQL Server Development, SQL Toolbox | Tagged , , | Leave a comment

Primary, Secondary, Tertiary, umm…?

I recently found myself asking the question posed in the title – what comes after primary, secondary, tertiary…? I had a rough idea, based on my drum line days, and the various types of Tenor drums. However, this article lays … Continue reading

Posted in SQL Toolbox | Tagged , | Leave a comment

Moving Database Logins

Recently we had a database issue, that necessitated us moving logins. Here’s an article I used from Microsoft to help script the logins. The KB is specifically for 2005 -> 2008, but it will also get you login’s out of … Continue reading

Posted in SQL Toolbox | Tagged , , , | Leave a comment

RePost: Database development mistakes made by application developers

Link Personally, I think this should also include database developers operating on too little sleep and/or too close of a deadline.

Posted in SQL Server Development | Tagged | Leave a comment

Enable CLR

This is just one of those things that I always forget how to do. EXEC sp_CONFIGURE ‘SHOW ADVANCED OPTIONS’ , ‘1’ — Let me change it GO RECONFIGURE GO EXEC sp_CONFIGURE ‘CLR ENABLED’ , ‘1’ GO RECONFIGURE GO EXEC sp_CONFIGURE … Continue reading

Posted in SQL Toolbox | Tagged , | Leave a comment

T-SQL Creativity

This article has little to do with useful t-sql applications – since to me, minesweeper is meant for a mouse. However, it really demonstrates a fun use of t-sql. Minesweeper in T-SQL

Posted in Uncategorized | Tagged , | Leave a comment