参考:http://www.doc88.com/p-38173950909.html
1 分离置疑的数据库。
2 按网址作业,创建新同名数据库名称。
3 断开企业管理器连接。
4 用置疑数据库替换新创建的数据库。
5 删除LOG文件。
6 连接企业管理器。
7 master下执行下面SQL。
--exec sp_configure 'allow updates',1 reconfigure with override
--update sysdatabases set status=32768 where name=‘数据库名称'
--dbcc rebuild_log('数据库名称','C:\Program Files (x86)\Microsoft SQL Server\MSSQL\Data\db_log.ldf')
--update sysdatabases set status=0 where name='数据库名称'
--restore database 数据库名称 with recovery
--exec sp_configure 'allow updates',0 reconfigure with override
8 退出查询分析器。
9 打开数据库。
-----------------------------
修复数据库表
--exec sp_dboption 'mpdata','single_user','true'
--dbcc CHECKTABLE('khxx',REPAIR_ALLOW_DATA_LOSS)
--exec sp_dboption 'mpdata','single_user','false'
解决方法如下:
qlserver 批量插入记录时,对有标识列的字段要设置 set IDENTITY_INSERT 表名 on,然后再执行插入记录操作;插入完毕后恢复为 off 设置
格式:
set IDENTITY_INSERT 表名 on
set IDENTITY_INSERT 表名 off