5

I am using SQL Server Management Studio 2012 and am trying to update the Fonts and Colors using my Visual Studio dark theme settings and in doing so, I've found something a bit weird:

UPDATE is being colored with the color assigned to the SQL System Function display item.

SELECT, INSERT, and DELETE all are colored with the color assigned to the Keyword display item.

So the question is, why is the Keyword UPDATE being considered as if it were a SQL System Function?


UPDATE

I have noticed that this same issue also occurs in Visual Studio with the 2012 version of the SQL Server Data Tools installed. This may also be an Intellisense bug.

I have reported this as a bug at Microsoft Connect under SQL Server.

Community
  • 1
  • 1
Code Maverick
  • 20,171
  • 12
  • 62
  • 114
  • @Downvoter - How does this question not show any research effort? How is it unclear or not useful? *These are reasons one should downvote*. I'm not sure it deserves a DV for those reasons. Is there something I need to edit? – Code Maverick Feb 05 '14 at 20:56
  • 1
    I was avoiding to use SSMS 2016 because of this. I have to switch to it now. But why on earth they had to change it? It was fine in SSMS 2008. I'd say that update is mostly used as a keyword, not system function (although it's my pattern, may be there're some developers who never write update statements but checking for updated columns in triggers every day). – Roman Pekar May 08 '17 at 13:48
  • @RomanPekar I agree 100%. It's sad that it's still an issue. – Code Maverick May 09 '17 at 14:40

1 Answers1

5

Because it is also a Trigger function, you can use it like UPDATE(ColumnName) and this will return true or false if you updated that coulmn.

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.

Microsoft's Official Response (link):

Hello Scott. Because of the ambiguity of how UPDATE can be used, it will sometimes appear to be the correct color and sometimes not. This behavior is known and by design. Thank you for you feedback.

Net Dev
  • 416
  • 4
  • 21
  • It has other uses too, like INSERT and DELETE but *not* SELECT, e.g. create a trigger FOR UPDATE. Though it is interesting that system function status would override keyword status. – Aaron Bertrand Oct 21 '13 at 19:24
  • @AaronBertrand - That was my line of thinking as well. Why would the function status be given a higher priority than its keyword status? Or more specifically with respect to the color, why wouldn't be able to determine it's status based on how it's being used in the query? If it's a keyword, color it that way. If it's a function, color it that way. – Code Maverick Oct 21 '13 at 19:27
  • @Scott no idea, and I don't think you'll get a valid answer for *that* question here except for opinions and conjecture. You can get a valid answer for why it might be considered either, but not for the priority. You'll have to talk to the folks who coded Management Studio (and I have a pretty good line of contact with them, and they still can't explain to me why the list of those things are not in alphabetical order, or why it is too hard to fix that). – Aaron Bertrand Oct 21 '13 at 19:29
  • @Scott sure, you can make SSMS a bit smarter, but that is significantly more complex than the current algorithm. And remember to think about how Microsoft probably prioritizes work: if it sells licenses, it floats to the top, if it doesn't... – Aaron Bertrand Oct 21 '13 at 19:30
  • 1
    @AaronBertrand - I understand. If it was to be colored one way or the other, it makes more sense to have it colored as a keyword, since it's primarily used as such. – Code Maverick Oct 21 '13 at 19:34
  • @Scott, I can see it being argued both ways, but like Aaron said all I think your going to get is opinions and conjecture. – Net Dev Oct 22 '13 at 11:05