Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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'.
share|improve this question
2  
(a) why are you using reserved keywords (b) why are you relying on SSMS to put brackets around reserved keywords (c) how exactly are you designing the table that SSMS should do this for you (d) can't you either press the script button and deal with it yourself, or simply write your own CREATE TABLE script without using the flaky and buggy designers? –  Aaron Bertrand Nov 21 '13 at 6:20
    
If SSMS doesn't handle it for you - it is as mentioned above - time to script it/modify the script yourself. –  Allan S. Hansen Nov 21 '13 at 6:27
    
@AaronBertrand Yes. I have already used script table and inserted square brackets to it. But i just wanted to know is it error in SSMS? –  IT researcher Nov 21 '13 at 6:30
add comment

1 Answer

up vote 1 down vote accepted

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).

share|improve this answer
    
Yes. You are correct. Before i have also posted some errors in SSMS. But all of them are closed as "By design". –  IT researcher Nov 21 '13 at 7:32
    
Also in SSMS if we manually put bracket around 'merge' then it will not take it and removes it.We can only script it and add brackets. –  IT researcher Nov 21 '13 at 7:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.