Tags » T-SQL

Finding something unique...

I wish this was an unusual situation…  Recently I was asked to develop the ETL process for a system I had never used before.  The company that provided the system didn’t want to help or provide documentation to assist in my development.  75 more words


Temp table quiz

Brent Ozar (b/t) posted a pop quiz on twitter earlier today.

Go ahead and give it a shot .. I’ll wait. … 493 more words

SQLServerPedia Syndication

A Good Reason to Explicitly Add Clustered Index Key to Covering Indexes

Some time ago I learned that the clustered index (CI) key is implicitly included in all non-clustered indexes (NCIs). This means that if I am creating a covering index for a query that features the CI key, I don’t need to explicitly add the key to the index. 94 more words

SQL Server

Find the database when table name is known


We have a table name or at least a part of it with us. We want to know the database to which it belongs. Manually searching is not possible/ difficult as there are many databases having many more tables. 320 more words


Query to find total disk space usage of DB(s)

SELECT sys.databases.name,
CONVERT(VARCHAR,SUM(size)*8/1024)+’ MB’ AS
FROM sys.databases
JOIN sys.master_files
ON sys.databases.database_id=sys.master_files.database_id
GROUP BY sys.databases.name
ORDER BY sys.databases.name


T-SQL - Where Is a Table Used?

Another “put it in my blog so I don’t lose it” T-SQL nugget.

Nicer than just a raw text-based search, a where-used search for a named table. 47 more words

SQL Server