You are here

Error message

  • Deprecated function: Array and string offset access syntax with curly braces is deprecated in include_once() (line 20 of /home/benjfc5/public_html/main/includes/
  • Deprecated function: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in include_once() (line 1387 of /home/benjfc5/public_html/main/includes/
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home/benjfc5/public_html/main/includes/

SQL Server - All Objects On Instance Sorted By Date

One common question I hear whenever something begins to go wrong is, "Has anything been changed recently?" Finding recent changes can be a good place to search, depending on the issue, so here is a script to do just that.

	-	Relatively light weight - runs in a couple seconds.
	-	Does not modify any objects (except the temp table made within)
	-	Displays all objects on instance sorted by modified date descending
	-	Identifies whether it was new or modified
	Author: Ben Farnsworth 
			Reference for Types:

	[dbName] VARCHAR(100)
	,[obj_name] VARCHAR(255)
	,[type] VARCHAR(100)
	,[create_date] DATETIME
	,[modify_date] DATETIME
	,[New or Modified] VARCHAR(100)

sp_msforeachdb @command1 = '

USE [?]

SELECT ''?'',name,
	WHEN type = ''AF''	THEN ''Aggregate Function''
	WHEN type = ''C''		THEN ''CHECK constraint''
	WHEN type = ''D''		THEN ''Default or DEFAULT constraint''
	WHEN type = ''F''		THEN ''FOREIGN KEY Constraint''
	WHEN type = ''L''		THEN ''Log''
	WHEN type = ''FN''	THEN ''Scalar function''
	WHEN type = ''FS''	THEN ''Assembly (CLR) scalar-function''
	WHEN type = ''FT''	THEN ''Assembly (CLR) table-valued function''
	WHEN type = ''IF''	THEN ''In-lined table-function''
	WHEN type = ''IT''	THEN ''Internal table''
	WHEN type = ''P''		THEN ''Stored procedure''
	WHEN type = ''PC''	THEN ''Assembly (CLR) stored-procedure''
	WHEN type = ''PK''	THEN ''PRIMARY KEY constraint (type is K)''
	WHEN type = ''RF''	THEN ''Replication filter stored procedure''
	WHEN type = ''S''		THEN ''System table''
	WHEN type = ''SN''	THEN ''Synonym''
	WHEN type = ''SQ''	THEN ''Service queue''
	WHEN type = ''TA''	THEN ''Assembly (CLR) DML trigger''
	WHEN type = ''TF''	THEN ''Table function''
	WHEN type = ''TR''	THEN ''SQL DML Trigger''
	WHEN type = ''TT''	THEN ''Table type''
	WHEN type = ''U''		THEN ''User table''
	WHEN type = ''UQ''	THEN ''UNIQUE constraint (type is K)''
	WHEN type = ''V''		THEN ''View''
	WHEN type = ''X''		THEN ''Extended stored procedure''
AS [Type],
 create_date, modify_date,
WHEN create_date = modify_date THEN
	AS [New or Modified]

FROM sys.objects
--WHERE type = ''P''
ORDER BY modify_date DESC


SELECT * FROM #t WHERE DB_ID(dbName) > 4 ORDER BY modify_date DESC

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer