1

Using SQL server 2008

column name is : file.retry

I want to drop the column file.retry. while running the below query getting the exception

ALTER TABLE FILEQ DROP COLUMN file.retry

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '.'.

How to solve this issue. Any one can help please

neer
  • 4,031
  • 6
  • 20
  • 34
Gopal
  • 11,712
  • 52
  • 154
  • 229
  • I found this, which seems like it answers your problem: http://dba.stackexchange.com/questions/1166/is-it-okay-to-put-dots-in-sql-server-database-names Try wrapping the table name in brackets [ ] – MartinMouritzen Jul 23 '16 at 07:54
  • 1
    There's a basic recommendation to avoid any name which needs to be enclosed in brackets (or Standard SQL's double quotes). – dnoeth Jul 23 '16 at 09:09
  • 2
    Possible duplicate of [How to deal with SQL column names that look like SQL keywords?](http://stackoverflow.com/questions/285775/how-to-deal-with-sql-column-names-that-look-like-sql-keywords) – maraca Jul 23 '16 at 09:59

2 Answers2

8

Surround file.retry in square brackets like so [file.retry] to avoid the interpreter trying to parse it as a table.column identifier.

ALTER TABLE FILEQ DROP COLUMN [file.retry]

Jonathon Ogden
  • 1,562
  • 13
  • 19
2

Use square brackets around the column name

ALTER TABLE FILEQ DROP COLUMN [file.retry]
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107