create column with comma in name RRS feed

  • Question

  • Hello,

    It's probably asked before, but don't seem to find anything.

    I want to create a column in an access table.

    The name of the column should contain a comma.

    The command is something like;  

    Using cmd As New OleDb.OleDbCommand("CREATE TABLE tablename ( " & _ 
    "ColumnName123,4 NVarchar(50)," &_
    "CONSTRAINT [pk_ColumnName123,4]" &_
    "PRIMARY KEY (ColumnName123,4)) ", cnn)

    I tried to replace the comma in the name with stuff like ',' and "," , ..

    But this doesn't work. Or maybe it's impossible.

    How can I proceed with this?

    thanks in advance,

    Wednesday, July 18, 2012 6:13 PM


All replies

  • Hello, you can not use a comma in a column name, see the following article http://support.microsoft.com/kb/826763


    • Proposed as answer by Paul P Clement IV Thursday, July 19, 2012 1:37 PM
    • Marked as answer by MTHulli Friday, July 20, 2012 11:51 AM
    Wednesday, July 18, 2012 8:24 PM
  • It look's like you're correct.

    This is very annoying because;

    -with a point in  the column name, access throws an error,

    -With a comma in the column name, I get this "syntax error".

    changing the regional settings also doesn't solve it.

    Thanks for your response.

    Friday, July 20, 2012 11:51 AM