Simple Windows 7 trick I learned on learn.iis.net today. To open an application as an administrator from the Start Menu (apart from right clicking and […]
Continue readingQuery Size of Tables in T-SQL
Useful command for SQL 2005 and above to see the size of each table in a given database: USE databasename EXEC sp_MSforeachtable @command1=”EXEC sp_spaceused ‘?'” […]
Continue readingQuery the INFORMATION_SCHEMA for Table Information
A very useful command to query for information about a table from INFORMATION_SCHEMA. Select * From INFORMATION_SCHEMA.COLUMNS Where TABLE_NAME=’TableName’
Continue readingShow File Stats
This DBCC SHOWFILESTATS command provides you with the data files for the current database that you select. DBCC SHOWFILESTATS or DBCC SHOWFILESTATS WITH NO_INFOMSGS will […]
Continue readingWITH Syntax to Create a Temporary Table
The WITH (common_table_expression) command creates a temporary table that can be used in a SELECT, INSERT, UPDATE, MERGE, or DELETE statement. Very useful for creating […]
Continue readingReturn Top 1 Field in a JOIN statement
This is a nice solution in that it groups the field used in the join statement. You can use this technique in many situations. I […]
Continue readingEscalate Privileges in Windows 7
Windows 7 requires you to escalate privileges before running your VBSCript. The following script reopens the script with administration privileges. If WScript.Arguments.length = 0 Then […]
Continue readingPass Exit Code (errorlevel) From One Batch Script to Another
It is often helpful to pass the exit code (errorlevel) from one batch script to another. You can do this using exit %errorlevel%, which closes […]
Continue readingMultiple Commands Within a CmdExec Job Step
One irritating problem with the Operating System (CmdExec) SQL Job Type is that you can only run a single command. Most people get around this […]
Continue readingQuery Database Size and Unallocated Space from SQL Database
I created the he following stored procedure to give me a more clear look at the unallocated and unused space used by my databases. The […]
Continue reading