Monthly Archives: June 2008

Microsoft SQL Server: How to find not partitioned tables

Script to find not partitioned tables containing some particular column
SELECT o2.NAME FROM sys.objects o
[code lang=”sql”]
INNER JOIN sys.indexes i ON o.OBJECT_ID=i.OBJECT_ID
INNER JOIN sys.partition_schemes ps ON ps.data_space_id=i.data_space_id
RIGHT OUTER JOIN sys.Objects o2 ON o2.OBJECT_ID=o.OBJECT_ID
INNER JOIN sys.columns c ON c.OBJECT_ID=o2.OBJECT_ID
WHERE o2.TYPE_DESC=’USER_TABLE’ AND c.NAME=’mycolumnname’ AND o.OBJECT_ID IS null
[/code]