USE master
GO
SELECT NAME,STATE_DESC FROM SYS.DATABASES
WHERE STATE_DESC='SUSPECT'
GO
USE master
GO
ALTER DATABASE db_PanCard SET EMERGENCY
GO
DBCC CHECKDB (db_PanCard, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS;
GO
SELECT state_desc FROM sys.databases WHERE name='db_PanCard'
go
ALTER DATABASE db_PanCard SET SINGLE_USER;
go
DBCC CHECKDB (DBNAME, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS;
go
SELECT state_desc FROM sys.databases WHERE name='db_PanCard'
GO
ALTER DATABASE db_PanCard SET MULTI_USER;