Run a query on all of the tables in your database

From: http://www.databasejournal.com/features/mssql/article.php/1490661
sp_MSforeachtable
By Brian Knight
Is there such a thing as a task where you would not need a cursor? Hidden in the depths of the Master database are a series of stored procedures that can replace some cursors with these one-liners.
Traditionally if you wanted to run a DBCC CHECKTABLE on every table in a database you’d [...]

Find Machine Names on local network from IP

I had an issue today where I needed to find all of the machine names on the local network along with their IP addresses.
Here is a batch file that helps do just that:
@echo off
echo > c:\network.txt IP Address NetBIOS Name
echo > c:\network.txt ============================
for /F %%a in (‘net view ^ find “\\”‘) do call :Sub %%a
goto [...]