sql中定义表变量失败,求援!
时间:2011-11-26
来源:互联网
我想定义一个表变量,如下:
declare @a as table(c1 decimal(30,5))
sql给出错误提示:
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:836629; actual 0:0). It occurred during a read of page (1:836629) in database ID 2 at offset 0x0000019882a000 in file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\tempdb.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
既然定义表变量失败,我想我就定义一个临时表吧,如下:
CREATE TABLE #a(c1 decimal(30,5))
还是同样的失败,同样的失败提示。
于是,我就DBCC CHECKDB一下吧,结论是:
CHECKDB found 0 allocation errors and 0 consistency errors in database 'model'.
没法了,sos!
作者: raylee1983 发布时间: 2011-11-26
declare @a table(c1 decimal(30,5))
作者: roy_88 发布时间: 2011-11-26
作者: roy_88 发布时间: 2011-11-26
declare @a table(c1 decimal(30,5))
作者: roy_88 发布时间: 2011-11-26
use master
go
dbcc checkdb('tempdb')
作者: NBDBA 发布时间: 2011-11-26
我之前也是可以正常通过这条语句的,今天突然就不行了。
作者: raylee1983 发布时间: 2011-11-26
tempdb error,run:
use master
go
dbcc checkdb('tempdb')
运行的结果,怎么解决呢?
Msg 7985, Level 16, State 2, Line 1
System table pre-checks: Object ID 13. Could not read and latch page (1:836626) with latch type SH. Check statement terminated due to unrepairable error.
DBCC results for 'tempdb'.
Msg 5256, Level 16, State 1, Line 1
Table error: alloc unit ID 0, page (1:836626) contains an incorrect page ID in its page header. The PageId in the page header = (0:0).
CHECKDB found 0 allocation errors and 1 consistency errors not associated with any single object.
CHECKDB found 0 allocation errors and 1 consistency errors in database 'tempdb'.
作者: raylee1983 发布时间: 2011-11-26
每次启动 SQL Server 时都会重新创建 tempdb
作者: roy_88 发布时间: 2011-11-26
还是同样的错误提示啊。
我之前也是可以正常通过这条语句的,今天突然就不行了。
临时表和表变量缓存在Tempdb,你重扈一下SQL服務試試,不行估計需要重建系統庫Model
作者: roy_88 发布时间: 2011-11-26
引用 5 楼 raylee1983 的回复:
还是同样的错误提示啊。
我之前也是可以正常通过这条语句的,今天突然就不行了。
临时表和表变量缓存在Tempdb,你重扈一下SQL服務試試,不行估計需要重建系統庫Model
解决了!
我在services.msc里面关闭所有和sql有关的服务,再重新启动一次,就可以了。
感谢中国风!
作者: raylee1983 发布时间: 2011-11-26
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28