当我们使用SQL Server 2008写SQL语句时使用关键字update
,它在 blue
中着色:
但是当我们在 SQL Server 2014 中编写相同的 SQL 时,它在 magenta
中:
正如我们所知,SQL Server 中的洋红色通常不是用于关键字,而是用于 built-int functions
, 或 datepart
(和其他一些):
(在上面的例子中, Datename
和 getdate
是内置的 functions
而 day
和 week
是 datepart
)
但是select
, create
, insert
, 和 delete
关键字都是一致的 blue
在 SQL Server 中:
这种变化背后的原因是什么(现在是 update
是 function
)?有什么办法可以改变update
颜色返回 blue
在 SQL Server 2014 中?
最佳答案
它是一个触发器函数,您可以像 UPDATE(ColumnName) 一样使用它,如果您更新了该函数,它将返回 true 或 false。
MSDN Update Function()
Returns a Boolean value that indicates whether an INSERT or UPDATE attempt was made on a specified column of a table or view. UPDATE() is used anywhere inside the body of a Transact-SQL INSERT or UPDATE trigger to test whether the trigger should execute certain actions.
关于SQL 语句 "Update"SQL Server 2014 中的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35881906/