At http://www.toadworld.com/platforms/sql-server/w/wiki/9680.updating-statistics.aspx (good read) there is a query that I don't fully understand, but I converted it into this, below (SQL Server 2005). Output:
CREATE STATISTICS [IX_student_2012_1] ON [student_2012] ([student_key])
CREATE STATISTICS [IX_student_2012_2] ON [student_2012] ([dbname], [id])
CREATE STATISTICS [IX_student_2012_3] ON [student_2012] ([forename], [surname], [dob])
CREATE STATISTICS [_WA_Sys_00000003_158238E1] ON [student_2012] ([surname])
CREATE STATISTICS [_WA_Sys_00000051_158238E1] ON [student_2012] ([Own_coun])
CREATE STATISTICS [_WA_Sys_00000010_158238E1] ON [student_2012] ([ethnic])
Obviously some of those come from indexes. You can probably improve the query to remove those; you don't need copies. And you can add "WITH FULLSCAN", of course.
I'm interested in this, because we load enterprise data into some databases overnight, so that reports can be run during the day. If I generate some statistics during the overnight run - "WITH FULLSCAN" - then the reports will run better because they don't need to make the statistics. If SQL Server creates statistics, I don't assume that there really needs to be an index on the columns instead, but I will think about it. In fact I don't understand[+] why ever have just statistics when you can have indexes, but I assume there are good reasons! [+]Well, I understand a bit - otherwise that would be not a very good article!
Robert Carnegie, likes indexes!
--Generate Statistics definitions for a given table.
N'CREATE STATISTICS ' +
N' ON ' +
N' (' +
SUBSTRING((SELECT ( ', ' + QUOTENAME(c1.name) )
FROM sys.stats_columns sc1 JOIN sys.columns c1
ON sc1.object_id = c1.object_id
AND sc1.column_id = c1.column_id
WHERE sc1.object_id = sc2.object_id
AND sc1.stats_id = s.stats_id
FOR XML PATH( '' )
), 3, 4000 )
sys.stats_columns sc2 JOIN sys.columns c2
ON sc2.object_id = c2.object_id
AND sc2.column_id = c2.column_id
JOIN sys.stats s
ON sc2.object_id = s.object_id
AND sc2.stats_id = s.stats_id
WHERE sc2.object_id = object_id('Student_2012') --substitute Tablename
ORDER BY s.stats_id