Skip to content

Tag: sql-server-2008

How to find unused tables in SQL Server

Is there a way of finding out when the data was last entered into a table? I’m trying to find obsolete tables within my database and would like to know if there is a simple script(s) that I can run? Answer You could try check the results of querying the sys.dm_db_index_usage_stats Dynamic Management Vie…

Parameterize an SQL IN clause

How do I parameterize a query containing an IN clause with a variable number of arguments, like this one? In this query, the number of arguments could be anywhere from 1 to 5. I would prefer not to use a dedicated stored procedure for this (or XML), but if there is some elegant way specific to SQL Server 2008…