久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

@@TRANCOUNT 和當(dāng)前連接

@@TRANCOUNT and a current connection(@@TRANCOUNT 和當(dāng)前連接)
本文介紹了@@TRANCOUNT 和當(dāng)前連接的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

假設(shè)我通過 SQL Server Management Studio ( SSMS ) 連接到 SQL Server 2008 并通過單擊新建查詢"選項(xiàng)卡打開新窗口 W1 并在 W1 中寫入以下內(nèi)容:

Assume I connect to SQL server 2008 via SQL Server Management Studio ( SSMS ) and open new window W1 by clicking on New Query tab and write the following inside W1:

BEGIN TRANSACTION;

如果我執(zhí)行這個(gè)語句5次,然后寫(在W1里面)

If I execute this statement 5 times, and then write (inside W1)

SELECT @@TRANCOUNT;

,那么返回的值將是 5.但是如果我打開另一個(gè)窗口 W2(在同一個(gè) SSMS 實(shí)例內(nèi),因此在同一個(gè)連接上)并在 W2 內(nèi)寫入

, then the value returned will be 5. But if I open another window W2 ( inside the same SSMS instance and thus on the same connection ) and write inside W2

SELECT @@TRANCOUNT; 

那么返回的值為 0.

@@TRANCOUNT 變量返回當(dāng)前連接的活動事務(wù)數(shù).

@@TRANCOUNT variable returns the number of active transactions for the current connection.

W1 和 W2 窗口都在同一個(gè)連接上打開,所以不應(yīng)該(根據(jù)上面的引用)在 W1W2 變量 @@TRANCOUNT 中保持相同的價(jià)值?

Both W1 and W2 windows were opened on the same connection, so shouldn’t ( according to the above quote ) in both W1 and W2 variable @@TRANCOUNT hold the same value?

謝謝

推薦答案

SSMS 中的每個(gè)查詢窗口都是一個(gè)單獨(dú)連接,在單獨(dú)的 spid 上運(yùn)行.查詢窗口選項(xiàng)卡中括號中的數(shù)字是您當(dāng)前窗口的連接號.

Every query window in SSMS is a separate connection, running on a separate spid. The number in parenthesis in the query window tab is your connection number for the current window.

打開幾個(gè)窗口,并根據(jù)需要在每個(gè)窗口中打開事務(wù),您應(yīng)該能夠看到每個(gè)窗口都顯示在調(diào)用 sp_who2 的結(jié)果中.使用窗口選項(xiàng)卡中的 spid 編號,您將能夠在該過程的結(jié)果中找到每一行.您還可以在每個(gè)查詢窗口底部的狀態(tài)欄中以及每個(gè)打開的查詢窗口的屬性窗口中找到有關(guān)您的連接的詳細(xì)信息.

With a couple windows open, and open transactions in each if you like, you should be able to see each one of them show up in the results of a call to sp_who2. Using the spid number from the window tab you'll be able to find each row in the results of that proc. You can also find detailed information about your connection in the status bar at the bottom of each query window, and also in the properties window for each open query window.

這篇關(guān)于@@TRANCOUNT 和當(dāng)前連接的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個(gè)子標(biāo)記轉(zhuǎn)換為具有多個(gè)分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個(gè)表創(chuàng)建視圖?)
Create calculated value based on calculated value inside previous row(根據(jù)前一行內(nèi)的計(jì)算值創(chuàng)建計(jì)算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發(fā)技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉(zhuǎn)換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 91久久综合亚洲鲁鲁五月天 | 国产乱国产乱300精品 | 福利视频一区二区 | 免费黄色大片 | 久本草精品 | 国产精品福利视频 | 国产三级在线播放 | 性久久久久 | 91成年人 | 黄色小视频免费观看 | 91网站免费 | 极品新婚夜少妇真紧 | 日韩一级黄 | 日韩中文字幕在线观看 | 国产精品第二页 | 91白浆| 国产精品一区二区性色av | 中文字幕精品在线观看 | 99精品在线 | 免费美女视频 | 狠狠干 | 成人欧美一区二区三区白人 | 四虎黄色网址 | 韩国三级中文字幕hd久久精品 | 中文字幕国产视频 | 国产午夜一区二区 | 国产一区二区免费看 | a级片免费观看 | 久久人人爽 | 中文字幕免费av | 日本黄色免费视频 | 日韩一级在线观看 | 国产黄a三级 | 日本免费在线观看 | 亚洲一区二区三区视频 | 青青草免费在线观看 | 欧美日韩视频在线 | 香蕉视频导航 | 新香蕉视频 | 精品国产乱码久久久久久影片 | 国产视频999|