Sqlinsertinto... select... deadlock Solution

Source: Internet
Author: User
Sqlinsertinto... select... deadlock Solution

SQL insert into... select... deadlock Solution

SQL insert into... select... deadlock Solution

Method 1

Insert into a select * from B with (xlock) where form_no = @ form_no

Method 2,

Sp_who -- sql2000 and above
Dbcc inputbuffer (spid) -- used to view specific statements
Kill spid -- kill the process.
-- Or
Select * from sys. sysprocesses -- sql2005 and later
A. Top Five queries by average cpu time
This solution provides information about the cpu time, io read/write, and the number of executions of the first five queries based on the average cpu time.

Select top 5
Total_worker_time/execution_count as [avg cpu time],
(Select substring (text, statement_start_offset/2, (case when statement_end_offset =-1 then len (convert (nvarchar (max), text) * 2 else statement_end_offset end-statement_start_offset) /2) from sys. dm_exec_ SQL _text (SQL _handle) as query_text
From sys. dm_exec_query_stats


Order by [avg cpu time] desc

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.