Why words in T-SQL turn blue?
by Cecille Ramirez on January 31st, 2011This is a pretty common question for students beginning with SQL Server writing queries regardless of the version. Why some words turn blue when you type it in the query window using any T-SQL statement?
These are reserved keywords. Microsoft SQL Server uses these for defining, manipulating and accessing databases and all objects in it. It is part of the grammar of the T-SQL that allows SQL Server to parse and understand T-SQL statements. It maybe sometimes allowed using these reserved keywords for object names in a script but not recommended.
It is best to always use unique names for every object in your database. Make it a habit so you don’t encounter errors in the future. It will be difficult to analyze eventually what’s causing the error when you have overlooked the use of reserved keywords.
For the list of SQL Server 2008 reserved keywords, you can find it in this link: http://msdn.microsoft.com/en-us/library/ms189822(v=SQL.100).aspx