What is wrong with this SQL statement?

前端 未结 6 846
夕颜
夕颜 2021-01-23 00:06

I\'m trying to create this table and I want to gauge my eyes out. What is wrong with it? I get an error: \"Incorrect syntax near PLAN\"

create table Instrumentos         


        
相关标签:
6条回答
  • 2021-01-23 00:48

    Plan is a SQL reserved word.

    0 讨论(0)
  • 2021-01-23 00:53

    PLAN is a reserved keyword. Depending on which SQL engine you are using, you will have to escape that column name using either quotations or brackets, ie:

    "Plan" bit
    

    Or

    [Plan] bit
    

    And also do so in any queries, ie:

    INSERT INTO Instrumentos(..., [Plan], ...) VALUES (...)
    

    Or:

    INSERT INTO Instrumentos(..., "Plan", ...) VALUES (...)
    
    0 讨论(0)
  • 2021-01-23 00:59

    Two problems:

    1. Plan is SQL Server reserved word.
    2. ProyectoFinal column name is used twice.
    0 讨论(0)
  • 2021-01-23 01:02

    Plan is a reserved word. If you really want to use it, and I advise against it, you would need to enclose it in escape characters.

    0 讨论(0)
  • 2021-01-23 01:07

    PLAN is a reserved keyword.

    Change the name or use the appropriate escape for your server type. For MSSQL, I think you'd use [Plan], but you'll have to do that any time you write a query/procedure/etc.

    0 讨论(0)
  • 2021-01-23 01:08

    Plan is probably a SQL keyword (e.g, "EXPLAIN PLAN").

    Either escape the column name or change it.

    0 讨论(0)
提交回复
热议问题