USE MASTER
GO
sp_dboption 'AZDATA_001_2005','single user','true'
GO
DBCC CHECKDB('AZDATA_001_2005',REPAIR_REBUILD)
GO
USE AZDATA_001_2005
GO
exec sp_msforeachtable 'DBCC CHECKTABLE(''?'',REPAIR_REBUILD)'
exec sp_msforeachtable 'DBCC DBREINDEX(''?'')'
GO
sp_dboption 'AZDATA_001_2005', 'single user', 'false'
GO