News

Copyright © 2008-2018 Paula DiTallo

Tag Cloud


May 2018 Entries


SQL Server: Find existing temp tables on a server.

-- query the server to examine all the existing temp tables

select name, object_name(object_id) As ObjName,*
 from tempdb.sys.objects
 where name like '#%'

SQL Server: How do look at the dataypes/lengths of columns in a temp table?

To view that information, there are 2 primary ways:select * from tempdb.INFORMATION_SCHEMA.C... where table_name like '#MyTempTable%'select * from tempdb.sys.columns where object_id = object_id('tempdb..#mytempt... ......

SQL SERVER: How do I find all the tables that have had an update in a database?

This query will bring back the last user update to every table in the database you're connected to.use [dbname]goSELECT last_user_update, t.name FROM sys.dm_db_index_usage_stats us JOIN sys.tables t ON t.object_id = us.object_id WHERE database_id = db_id()and cast(last_user_update as date) >= cast('2018-05-09' as date)order by last_user_update desc ......