USE YourDatabase DECLARE @tableName varchar(255) DECLARE cur CURSOR FOR SELECT table_schema + '.' + table_name FROM information_schema.tables WHERE table_type = 'base table' OPEN cur FETCH NEXT FROM cur INTO @tableName WHILE @@FETCH_STATUS = 0 BEGIN DBCC DBREINDEX(@tableName,' ',90) FETCH NEXT FROM cur INTO @tableName END CLOSE cur DEALLOCATE curHowever, I discovered a much easier way to do it today:
sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"This is an undocumented stored procedure that I didn't even know existed until this morning. The cursor route is still useful for when you want to exclude tables, but dang....I wish I'd known of this earlier.
To determine which version of the .NET framework an assembly supports, you can use ILDASM.
Open up a visual studio command prompt, and type the following:
ildasm.exe C:Yourdll.dll /metadata[=MDHEADER] /text /noil
You'll get a large amount of indecipherable data, but right at the top, you'll see something to the effect of
// Metadata section: 0x424a5342, version: 1.1, extra: 0, version len: 12, version: v4.0.30319
where the highlighted piece gives you the supported version.
Alternatively, you can just open ildasm (just type ildasm at the command prompt), and open up the dll - you can see the metadata version right at the top by double-clicking "MANIFEST":