Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

List the value of @@DBTS in all your databases

From Wiki

Jump to: navigation, search

The @@DBTS function returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated. This code below will give you the output for @@DBTS in all the databases on your server

  1. exec sp_msforeachdb 'use ? select ''?'', @@dbts '

In my case the output is the following.

DB Value
master 0x0000000000000FA0
tempdb 0x00000000000007D0
model 0x00000000000007D0
msdb 0x0000000000002EE0
test 0x00000000000007D6
AdventureWorks2008R2 0x0000000000001F40
SSISDB 0x00000000000007D0
ignite 0x00000000000007D0

Contributed by: --SQLDenis 10:54, 8 December 2010 (GMT)

Part of SQL Server Admin Hacks

805 Rating: 2.6/5 (45 votes cast)