在論壇看到有人執行了一個UPDATE,但是發現錯了,問是否可以取消這個更新操作。因為涉及的資料比較多,所以怕取消操作造成資料不一致。 其實對於單獨的UPDATE操作而言,都是當做一個隱性交易處理的,具有ACID屬性,Non或者All.所以不管這個UPDATE會影響多少行,取消操作所有影響的行都會復原,保證事務完整性。 下面的解釋來自SQL SERVER 2008 INTERNALS: An implicit transaction is any individual INSERT,
有兩個方法可以查看Cursor是否Open: 1.查詢syscursors系統資料表: Select * from MASTER.dbo.syscursors 2. 使用CURSOR_STATUS函數: 比如:CREATE TABLE#TMP( ii int)GO INSERT INTO#TMP(ii)VALUES(1)INSERT INTO#TMP(ii)VALUES(2)INSERT INTO#TMP(ii)VALUES(3) GO --Create a cursor.DECLARE
今天想查看一個LSN是否包含在記錄備份,但是發現restore headeronly裡面的LSN格式跟fn_dblog的不同,不過可以通過下面的方法轉化。 Create DatabaseTestLSN;Go-- Make sure it is simple recoveryAlter DatabaseTestLSN Set Recovery full;GoUse TestLSN;Gocreate tabletest(testvarchar(10))-- Create a marked
Data density? Think of this as how packed full or data, index, or LOB rows a data file page is. The more free space on the page, the lower the data density.Low data density pages are caused by:Very wide data rows (e.g. a table with a 5000-byte fixed-
查詢SysObjects出現下面的錯誤: Msg 208, Level 16, State 1, Line 2Invalid object name 'SYSOBJECTS'. 可能的原因是資料庫大小寫敏感。If your database is created with a Case Sensitive collation then all object names will be Case Sensitive(MSDN). --查看當前資料庫的CollcationSELECT