SQL Server常用的全局变量(六)
'Login Name', USER AS 'User Name'
Here is the result set:
ID Login Name User Name
----- ------------- -----------
11 sa dbo
www.2cto.com
27.@@TEXTSIZE --返回SET语句中的TEXTSIZE选项的当前值
Examples
This example uses SELECT to display the @@TEXTSIZE value before and after it is changed with the SET TEXTSIZE statement.
SELECT @@TEXTSIZE
SET TEXTSIZE 2048
SELECT @@TEXTSIZE
Here is the result set:
------------------------
64512
------------------------
2048
28.@@TIMETICKS --返回每个时钟周期的微秒数
Examples
SELECT @@TIMETICKS
29.@@TOTAL_ERRORS --返回SQL Server子上启动后所遇到的磁盘写入错误数
Examples
This example shows the number of errors encountered by SQL Server as of the current date and time.
SELECT @@TOTAL_ERRORS AS 'Errors', GETDATE() AS 'As of'
Here is the result set:
Errors As of
------- -------------------------------
0 1998-04-21 22:07:30.013
30.@@TOTAL_READ --返回SQL Server子上启动后读取磁盘(不是读取高速缓存)的次数
Examples
This example shows the total number of disk read and writes as of the current date and time.
SELECT @@TOTAL_READ AS 'Reads', @@TOTAL_WRITE AS 'Writes', GETDATE() AS 'As of'
Here is the result set:
Reads Writes As of
--------- ----------- ------------------------------
978 124 1998-04-21 22:14:22.37
www.2cto.com
31.@@TOTAL_WRITE --返回SQL Server子上启动以来磁盘所执行的写入次数
Examples
This example shows the total number of disk reads and writes as of the current date and time.
SELECT @@TOTAL_READ AS 'Reads', @@TOTAL_WRITE AS 'Writes', GETDATE() AS 'As of'
Here is the result set:
Reads Writes As of
--------- ----------- ------------------------------
978 124 1998-04-21 22:14:22.37
32.@@TRANCOUNT --返回的钱连接的活动事务数
Examples
This example uses @@TRANCOUNT to test for open transactions that should be committed.
BEGIN TRANSACTION
UPDATE authors SET au_lname = upper(au_lname)
WHERE au_lname = 'White'
IF @@ROWCOUNT = 2
COMMIT TRAN
IF @@TRANCOUNT > 0
BEGIN
PRINT 'A transaction needs to be rolled back'
ROLLBACK TRAN
END www.2cto.com
33.@@VERSION --返回当前SQL Server安装的版本,处理体系结构,生成日期和操作
系统
Examples
This example returns the date, version, and processor type for the current installation.
SELECT @@VERSION
作者 OPK625153475