题目是
1. Execute the following commands to create a base table.
USE AdventureWorks
GO
SELECT * INTO temp_Employee FROM HumanResources.Employee
GO
CREATE NONCLUSTERED INDEX IX_Employee_ManagerID ON temp_Employee(ManagerID ASC)
CREATE NONCLUSTERED INDEX IX_Employee_ModifiedDate ON temp_Employee(ModifiedDate ASC)
GO
2. Enable trace flag 1222 and use SQL Server Profile to capture trace.
3. Execute the following commands by using connection 1.
USE AdventureWorks
GO
SET NOCOUNT ON
GO
WHILE (1=1)
BEGIN
BEGIN TRAN
UPDATE temp_Employee SET BirthDate=GETDATE() WHERE NationalIDNumber='480951955'
SELECT * FROM temp_Employee WHERE NationalIDNumber='480951955'
COMMIT TRAN
END
4. Switch to connection 2, and execute the following script.
USE AdventureWorks
GO
SET NOCOUNT ON
GO
WHILE (1=1)
BEGIN
BEGIN TRAN
UPDATE temp_Employee SET BirthDate=GETDATE() WHERE NationalIDNumber='407505660'
SELECT * FROM temp_Employee WHERE NationalIDNumber='407505660'
COMMIT TRAN
END
5. What happened, why, and how to resolve?
1. Execute the following commands to create a base table.
USE AdventureWorks
GO
SELECT * INTO temp_Employee FROM HumanResources.Employee
GO
CREATE NONCLUSTERED INDEX IX_Employee_ManagerID ON temp_Employee(ManagerID ASC)
CREATE NONCLUSTERED INDEX IX_Employee_ModifiedDate ON temp_Employee(ModifiedDate ASC)
GO
2. Enable trace flag 1222 and use SQL Server Profile to capture trace.
3. Execute the following commands by using connection 1.
USE AdventureWorks
GO
SET NOCOUNT ON
GO
WHILE (1=1)
BEGIN
BEGIN TRAN
UPDATE temp_Employee SET BirthDate=GETDATE() WHERE NationalIDNumber='480951955'
SELECT * FROM temp_Employee WHERE NationalIDNumber='480951955'
COMMIT TRAN
END
4. Switch to connection 2, and execute the following script.
USE AdventureWorks
GO
SET NOCOUNT ON
GO
WHILE (1=1)
BEGIN
BEGIN TRAN
UPDATE temp_Employee SET BirthDate=GETDATE() WHERE NationalIDNumber='407505660'
SELECT * FROM temp_Employee WHERE NationalIDNumber='407505660'
COMMIT TRAN
END
5. What happened, why, and how to resolve?
解决方案 »
- 向有三十万条数据的表更新数据会很慢?
- 库存分批出货
- 初用查询分析器遇到的一个查询更新问题
- 表变量某个字段长度是4000的字符串,循环把该字段记录相加如何保证突破字符串8000的限制?
- FORMAT_STRING 怎么用?
- 基础问题,如何在SQLSERVER数据库中存储图片?如何调用呢?
- MSSQL2000对文件的操作,求高手!
- 在SQL server中,怎样在插入一条记录时,不让空时间在数据库里变成了1900-01-01 ...
- 菜鸟今晚最后一个问题!operator/operand type mismatch:是什么原因!?
- 如何避免多用户同时更改数据库?
- 代替自增长列的SQL语句怎么写哦
- 急!急!急!SQL2005连接问题,在线等!!!
this:在执行批处理时出现错误。错误消息为: 引发类型为“System.OutOfMemoryException”的异常。
why?
死循环
但是好像没有产生死锁。
NationalIDNumber='480951955' 条件写的是不是有点问题。
发现有一个问题,如果出现锁,那么使用3楼和我说的方法,如果没有出现锁,那么应该会出现System.OutOfMemoryException的异常,内存溢出,因为你使用的循环条件是while 1=1永远循环下去,内存肯定不足。