Sql-server – SSMS gives error if column name is “MERGE” where as other keywords works

sql-server-2008-r2ssmstable

IN SSMS create table if we include sql keywords in column name then it will be wrapped around square brackets "[]" automatically and the table gets created without any error generally.

But if we include some keywords such as merge then SSMS will not insert square brackets around it and while saving table error is shown as

'Table_2' table
- Unable to create table.  
Incorrect syntax near the keyword 'MERGE'.
Incorrect syntax near the keyword 'NULL'.

Best Answer

This is yet another flaky bug in yet another inconsistent and unreliable visual designer in SSMS. My suggestions, in this order:

  1. Stop using the visual designers. Learn CREATE TABLE and other DDL syntax - not only does this break your dependence on terrible tools, it is also much easier to place these in source control, send them to colleagues, etc. When you are relying on pointing and clicking in a UI, your documentation of what you did will have to resort to Camtasia or other screen recording tools.
  2. Stop using reserved words for column names.
  3. If you must use keywords, put the brackets around them yourself.

I filed a bug on Connect, but don't hold your breath. Many of these buggy components of SSMS have been barely touched in years, and many usability bugs continue to get ignored unless they cause real problems (like data loss).