] @InOpenID = ' 1ccd524d-de62-47ca-87d3-38787b040ba3 ', @InTDesc = N ' received the transfer of a ', @OutOpenID = ' 2ccd524d-de62-47ca-87d3-38787b040ba3 ', @OutTDesc = N ' transfer to A100 ', @TAmount = @TTID = 1, @Result = @Result Outputselect@result as N ' @Result ' GOTest 2>: Simulate things with errors, roll backTo cancel a store: SELECT 1+ ' A ' comment (an error occurred in a simulated thing)use [Test]godeclare@return_value int, @Result intexec@return_value = [dbo]. [Paddtransaction] @InOp
Tags: BSP span end pre appear ROM transaction user begin ----View additions and deletions do not affect the underlying table
----view does not allow repeating columns
Create Viewhaha--Create a View
as
SelectStudent.*, Score.cno,score.degree fromStudent,scorewhereStudent. Sno=Score.snoSelect * fromhaha----Business
begin Tran
Insert intoUsersValues('Zhao Four','c002')
Insert intoUsersValues('Zhao','c001')
if @ @error>0
begin
rollback Tran;
En
1. Transaction replication works normally. An error occurs on a certain day:
I was so scared that I thought I had to redo it.
2. Visit the peak hours, and do not have time to redo it. I am lucky to put my dog on...
3. Use a dead horse as a live horse and try again:
A. Run
Use [distribution] sp_browsereplcmds '0x00093ffa00002a0e00e000000000', '0x00093ffa00002a0e00e000000000'
Obtain the transaction details o
Tags: run right-click Database PNG default transaction file log file LLBObjectiveNext we end up with the last few sections of the SQL Server Basic series, and then we'll talk about SQL Server performance tuning, and we'll get to t
/* When multiple stored procedures are called in a large SQL statement and multiple stored procedures are called in the called stored procedure, after multiple nested calls, if you need to roll back the entire transaction if the primary key is repeated or the business logic is not met, you can use the following mode for processing. You can also directly count data without raiserror. If an error occurs after
Every database in Sybase SQL Server, whether it is a system database (Master,model, Sybsystemprocs, tempdb), or a user database, has its own transaction log, each of which has a syslogs table. Log records the user's modifications to the database, so if the command is not cle
Copy Code code as follows:
DECLARE @name VARCHAR (25)
DECLARE @SQL VARCHAR (1000)
DECLARE @logid INT
DECLARE sysdatabase_name CURSOR for SELECT name from master.dbo.sysdatabases
OPEN Sysdatabase_name
FETCH NEXT from Sysdatabase_name into @name
While @ @FETCH_STATUS = 0
BEGIN
IF (@name not in (' xxx ')-database name that does not require log shrinkage
BEGIN
is 0
rollback Tran--rolling back things
Else
Commit Tran--Submit Things
--three paradigms of---database design
--1. The values in each column are single
--2. Meet 1, each table must have a primary key
--3. Satisfy 2, the foreign key table only appears in the primary key table in the primary key column, the other columns do not appear. When there are three columns in a table and more of the data is often duplicated, you need to take these columns out to create a separate table
--set a primary
Deleting a message will cascade the reply information. At this time, we need to use the transaction, as shown in the following SQLCopy codeThe Code is as follows:Alter procedure [dbo]. [proc_tb_leaveword_delete](@ LeavewordID INT,@ Record TINYINT OUTPUT)ASBEGINBEGIN TRYBEGIN TRANSACTIONDelete from tb_leavewordID WHERE leavewordID = @ leavewordIDDelete from tb_reply WHERE leavewordID = @ leavewordIDSET @ record = 0 -- SuccessCOMMIT TRANSACTIONEND TRYBE
Tags: style blog http using io strong file dataEvery time the database log to see the explosion of some big head, so random search a way to get rid of the log, the next big head, and search for half a day, so or write a blog, do not look for a mess.1. Set the database to Simple modeSelect the database you want to shrink, right-click Properties---options, select Simple Mode2. Select tasks, shrink-file3. Sele
SQL cannot log on to the SQL console= = = Problem description A domain-joined SQL production server, login repeatedly failed to view the error message after the prompt "in the SQL Server
The transaction log (Transaction logs) is a very important but often overlooked part of the database structure. Because it is not as active as the schema in the database, few people are concerned about the transaction log.
The transacti
SQL Server Log Vacuuming methodPerform the following three steps sequentially in Query Analyzer, where databasename is your database filename
sql2000 Log Empty
You can make jb51.ldf files very small, make it easy to back up databases, and so on, and execute them in SQL
DBCC LoginfoDBCC log (' Qssys ', type=2)GoSELECT * from Sys.fn_dblog (null,null)Select [Dirty pages],[minimum lsn],[checkpoint end],[chkpt Begin DB version],[checkpoint begin],operation,context,[log Record length],allocunitname from Fn_dblog (null,null)SELECT * FROM dbo. T_companyaccount with (NOLOCK)Operation: Operations done by the current LSNCURRENTLSN: Serial number uniquely identified in the
The sql2008 shrink log is as follows:
The code is as follows
Copy Code
BACKUP LOG dbname to disk= ' Dbname.log 'DBCC shrinkfile (' Dbname_log ', 1)
But remember to perform two times before you can finally perform the contraction;
Shrink database files (if not compressed, database files do not reduce Enterprise Manager--right--the database you want to compress--all tas
recommended to truncate logs on the production database unless you have good reasons and are sure enough, or ......You are not responsible for this.
Since this method is not safe, I will introduce a security method below.As we all know, SQL Server will automatically cut off the inactive part of the transaction log wh
Label: You can use log shipping to send transaction logs uninterrupted from one database (primary database) to another (secondary database). Continuously back up the transaction logs in the primary database, and then copy and restore them to the secondary database, which basically keeps the secondary database in sync with the primary database. The target
Method 1, Sys.dm_tran_session_transactions;Method 2, DBCC OPENTRAN--------------------------------------------------------------------------------------------------------------- ---------------------------------------------Method 1,Sys.dm_tran_session_transactionsSELECT * from Sys.dm_tran_session_transactions;GoPrint out the activity's transactions.Method 2,DBCC OPENTRANDBCC OPENTRANSummarize:From the results can be seen,Sys.dm_tran_session_transactions all current active transactions.DBCC OPENT
concurrent operations and ensure data integrity. SQL Server automatically adds the appropriate locks to the database based on the user's request. Assuming that a user operates on only a subset of the row data in one table, the system may add only a few row locks (rids) or page locks to support as many concurrent operations as possible for multiple users. However, if multiple records in a table are frequent
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.