Archive for the ‘Uncategorized’ Category

Tables without Indexes

Wednesday, April 21st, 2010

Indexes are one of the most important factors in determining query performance. Luckily the code for determining which tables lack a valid index is relatively simple:

SELECT   SCHEMA_NAME(schema_id) AS Schema,
  name AS Table
FROM   sys.tables
WHERE   OBJECTPROPERTY(OBJECT_ID,’IsIndexed’) = 0
ORDER BY schema_name, table_name;
GO

Copy a View into a Table

Monday, April 19th, 2010

A simple way to copy data from a view to a table:

SELECT * INTO {Table} FROM {View}