Description and illustration of global variables

Source: Internet
Author: User

First, global variables

Variable Meaning
@ @ERROR Error number of the last SQL error
@ @IDENTITY Last-inserted identity value
@ @LANGUAGE Language name currently in use
@ @MAX_CONNETIONS The maximum number of simultaneous connections that can be created
@ @ROWCOUNT Number of rows affected by the previous SQL statement (increment statement)
@ @SERVERNAME Name of the Local service
@ @SERVICENAME The name of the SQL service for this computer
@ @TIMETICKS The number of microseconds per scale for the current computer
@ @TRANSCOUNT Number of transactions opened by the current connection
@ @VERSION Version information for SQL Server

eg.

1 --version information for 01SQL Sever2 Select @ @VERSION3 Print 'version information for SQL Sever' +@ @VERSION4 --Query Results Microsoft SQL Server R2 (RTM)-10.50.1600.1 (Intel X86) APR 2 15:53:02 Copyright (c) Microsoft Cor Poration Enterprise Edition on Windows NT 6.1 <X86> (Build 7601:service Pack 1)5 6 --02 Number of transactions open for the current link7 Declare @ @transcount nvarchar( +)8 Select @ @transcount        9 --query result is nullTen  One --03 Number of microseconds per tick on the current computer A Select @ @timeticks - --Query Result 31250 -  the --04 SQL Service name on the computer - Select @ @SERVICENAME - --Query result MSSQLServer -  + --05 name of the Local service - Select @ @SERVERNAME + --Query Result 123-pc A  at --06 marked value for last insertion - Insert  intoStudentValues(111111,'Ming',1,2,12345678912,'Beijing','1996-1-11','@123', One) - Select @ @IDENTITY -  - --07 number of rows affected - Insert  intoStudentValues(111111,'Ming',1,2,12345678912,'Beijing','1996-1-11','@123', One) in Select @ @ROWCOUNT -  to --08 can be created, at the same time the maximum number + Select @ @MAX_CONNECTIONS  fromStudent -  the --09 Name of the language currently in use * Select @ @LANGUAGE $ Panax Notoginseng --10 last T-SQL error number - Insert  intoStudentValues(111111,'Ming',1,2,12345678912,'Beijing','1996-1-11','@123','NULL')---' null ' cannot be a string the Select @ @ERROR

Description and illustration of global variables

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.