Kusto 与 Microsoft SQL Server 之间的 MS-TDS/T-SQL 差异MS-TDS/T-SQL Differences between Kusto Microsoft SQL Server
下面是 Kusto 与 SQL Server 的 T-SQL 实现之间的主要差异的部分列表。Below is partial list of the main differences between Kusto and SQL Server's implementation of T-SQL.
CREATE、INSERT、DROP、ALTER 语句CREATE, INSERT, DROP, ALTER statements
Kusto 不支持通过 MS-TDS 修改架构或数据,也不支持上述 T-SQL 语句。Kusto doesn't support schema modifications or data modifications through MS-TDS, nor does it support the above T-SQL statements.
相关子查询Correlated sub-queries
Kusto 不支持 SELECT
、WHERE
和 JOIN
子句中的相关子查询。Kusto doesn't support correlated sub-queries in SELECT
, WHERE
, and JOIN
clauses.
TOP 风格TOP flavors
Kusto 会忽略 WITH TIES
,并将查询作为常规 TOP
计算。Kusto ignores WITH TIES
and evaluates query as regular TOP
.
Kusto 不支持 PERCENT
。Kusto doesn't support PERCENT
.
游标Cursors
Kusto 不支持 SQL 游标。Kusto doesn't support SQL cursors.
流量控制Flow control
Kusto 不支持流控制语句,但少数情况除外,如 IF
THEN
ELSE
子句,它与 THEN
和 ELSE
批处理具有相同的架构。Kusto doesn't support flow control statements, except for a few limited cases, such as IF
THEN
ELSE
clause that has the identical schema for the THEN
and ELSE
batches.
数据类型Data types
根据查询的不同,返回的数据的类型可能与 SQL Server 中的数据类型不同。Depending on the query, the data returned may have a different type than in SQL Server.
在这里,一个明显的示例是 TINYINT
和 SMALLINT
之类的类型,它们在 Kusto 中没有等效项。An obvious example here are types such as TINYINT
and SMALLINT
that have no equivalent in Kusto. 因此,需要 BYTE
或 INT16
类型值的客户端可以改为获取 INT32
或 INT64
值。Therefore, clients that expect a value of type BYTE
or INT16
might get an INT32
or an INT64
value instead.
结果中的列顺序Column order in results
在 SELECT
语句中使用星号时,每个结果集中的列顺序在 Kusto 和 SQL Server 之间可能有所不同。When asterix is used in the SELECT
statement, the order of columns in each result set may differ between Kusto and SQL Server. 在这些情况下,使用列名的客户端会工作得更好。Client that use column names would work better in these cases.
如果 SELECT
语句中没有星号字符,则会保留列序号。If there is no asterix character in the SELECT
statement, the column ordinals would be preserved.
结果中的列名Columns name in results
在 T-SQL 中,多个列可能有相同的名称。In T-SQL, multiple columns may have the same name. 这在 Kusto 中是不允许的。This is not allowed in Kusto. 如果名称发生冲突,则列名在 Kusto 中可能会不同。In case of a collision in names, the names of the columns might be different in Kusto. 但是,至少会保留其中一列的原始名称。However, the original name would be preserved, at least for one of the columns.
ANY、ALL 和 EXISTS 谓词ANY, ALL, and EXISTS predicates
Kusto 不支持谓词 ANY
、ALL
和 EXISTS
。Kusto doesn't support the predicates ANY
, ALL
, and EXISTS
.
递归 CTERecursive CTEs
Kusto 不支持递归公用表表达式。Kusto doesn't support recursive common table expressions.
动态 SQLDynamic SQL
Kusto 不支持动态 SQL 语句(以内联方式执行由查询生成的 SQL 脚本)。Kusto doesn't support dynamic SQL statements (inline execution of SQL script generated by the query).
WITHIN GROUPWITHIN GROUP
Kusto 不支持 WITHIN GROUP
子句。Kusto doesn't support WITHIN GROUP
clause.
TRUNCATE 函数TRUNCATE function
Kusto 中 TRUNCATE 函数 (ODBC) 的工作方式类似于 ROUND,这意味着结果将是最接近的值,而不是 SQL 中返回的较小的值。TRUNCATE function (ODBC) in Kusto works similarly to ROUND, which means that the result will be the nearest value instead of the lower one returned in SQL.