消息102,级别15,状态1,行1错误语法附近' /'

时间:2015-06-24 23:52:17

标签: sql sql-server database

我正在使用此查询

Insert Into Menus(null, 'Item One', 'Desc') // First Parent Item
Insert Into Menus(null, 'Item Two', 'Desc') // Second Parent Item
Insert Into Menus(null, 'Item Three', 'Desc') // Third Parent Item

Insert Into Menus(1, 'Item Sub One', 'Desc') // Child of First Parent Item
Insert Into Menus(2, 'Item Sub Two', 'Desc') // Child of Second Parent Item
Insert Into Menus(3, 'Item Sub Three', 'Desc') // Child of Third Parent Item

我收到此错误

  

Msg 102,Level 15,State 1,Line 1
  ' /'

附近的语法不正确

2 个答案:

答案 0 :(得分:2)

在第一组括号内修复3列名称的正确名称:

Insert Into Menus (col1name, col2,col3) values (null, 'Item One', 'Desc');

答案 1 :(得分:0)

另一个问题:

// this is NOT a correct SQL comment
/* this is a correct SQL comment */ 
-- this also is a correct SQL comment