Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand SqlServer expressions

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to understand SqlServer expressions, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

0.1 scope of use

SQL Server (since 2008); Azure SQL database; Azure SQL data warehouse; parallel data warehouse

0.2 Grammar

Is a combination of symbols and operators evaluated by the SQL Server database engine to obtain a single data value. A simple expression can be a single constant, variable, column, or scalar function. Operators can be used to join two or more simple expressions into a complex expression.

-- Syntax for SQL Server and Azure SQL Database {constant | scalar_function | [table_name. ] Column | variable | (expression) | (scalar_subquery) | {unary_operator} expression | expression {binary_operator} expression | ranking_windowed_function | aggregate_windowed_function}-- Syntax for Azure SQL Data Warehouse and Parallel Data Warehouse-- Expression ina SELECT statement:: = {constant | scalar_function | column | variable | (expression) | {unary_operator} expression | expression {binary_operator} expression} [COLLATE Windows_collation_name]-Scalar Expression ina DECLARE, SET, IF … ELSE, or WHILE statement:: = {constant | scalar_function | variable | (expression) | (scalar_subquery) | {unary_operator} expression | expression {binary_operator} expression} [COLLATE {Windows_collation_name]

0.3 parameters

0.4 expression result

For a simple expression consisting of a single constant, variable, scalar function, or column name: the data type of the expression, collation, precision, scale, and value are data types, collation, precision, scale, and value reference elements.

When you combine two expressions using comparison or logical operators, the resulting data type is Boolean, which is one of the following values: TRUE,FALSE or UNKNOWN. For more information about Boolean data types, see comparison operator (Transact-SQL).

When two expressions are combined using arithmetic, bitwise or string operators, the operator determines the type of data generated.

A complex expression consisting of many symbols and operators is evaluated as a single-valued result. Combine expressions to determine the data type, collation, precision, and value of the generated expression, two at a time, until the final result is reached. The order in which expressions are combined is defined by the precedence of operators in the expression.

On how to understand the SqlServer expression to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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: 0

*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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report