In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "introduction to actual combat analysis of SQL Server". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Environmental Information:
OS:Windows
Software:SQL Server 、 Microsoft SQL Server Management Studio
Type: T-SQL
Events: database management
Documentation: SQL Server2016 from beginner to actual combat
I. Overview of T-SQL
This language is a structured query language designed and developed by Microsoft Company. It is an extension of SQL and has the main features of standard SQL. This language can achieve all the functions that the graphical interface can accomplish.
1. Notes
The unexecuted part of the code is generally an explanation of the function. The line from the beginning to the end of the code is in the non-execution stage, a single-line comment, a text block wrapped in / * /, and is generally used in multi-line comments.
2. Variables
Local variable: a name that acts within the program, starting with @, and must be defined with declare before it can be used
# define declare {@ l_v1 data_type} [,... n] # assign set @ l_v1=expressionselect {@ l_v1=expression} [,... n] # display print @ l_v1select @ l_v1declare @ name varchar (8), @ sex varchar (2), @ age smallintdeclare @ address varchar (100) set @ address=' Xuancheng 'select @ address
Global variables: non-user-defined, server-level, starting with @ @
Commonly used global variables
@ @ connections returns the last time you started SQL Server, the number of attempts to connect @ @ error returns the error code for the last execution of the SQL statement @ @ rowcount returns the number of rows affected by the last statement @ @ servername returns the name @ @ version of the local server that allows SQL Server to return the date, version, and processor type of SQL Server currently installed @ @ language returns the language of the SQL Server server
3. Operator
Arithmetic operator, assignment operator, bit operator, comparison operator, logical operator, string concatenation operator
II. T-SQL statement
1 、 DML
Data manipulation language: query, insert, delete, update
Select
Insert
Delete
Update
2 、 DDL
Data definition language: defining structure and data relations, etc.
Create
Alter
Drop
3 、 DCL
Data control language: data integrity and storage control
Grant
Revoke
Deny
III. Process control
1. Process control keywords
Declare: declare variables
Begin...end: define statement blocks
Berak: exit the while loop
Continue: restart the loop
Goto label: continue processing from the statement after label
If...else: two-branch judgment
Case...when...then...end: multi-branch judgment
Return: exit
Waitfor: waiting delay
While: cyclin
Print: output
2. Grammar format
Begin {select 、 insert 、 update... } endif xxx xxx if xxx xxxelse xxx xxx case xxxwhen xxx then xxx...when xxx then xxxelse xxxendwhile xxx xxx [bread] xxx [continue] "introduction to the actual combat analysis of SQL Server" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 221
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.