Search code examples
mysqlsql-serversql-insertcreate-tablesqlfiddle

SQL Fiddle MySQL 5.6 vs MS SQL Server 2017 - simple create and insert


I am running the following query on SQL Fiddle

With MySQL 5.6 the following works fine:

create table test (col_1 varchar(10), col_2 int);

insert into test (col_1, col_2)
values ("A", 3),
      ("B", 7),
      ("A", 1),
      ("B", 2);

But with MS SQL Server 2017 for the same query. I am getting back error:

Invalid column name 'A'.

Should the syntax be the same for both SQLs?

Here is a snapshot of error:enter image description here


Solution

  • You should use single quote (double quote in SQLserver are for columns name)

      insert into test (col_1, col_2)
      values ('A', 3),
            ('B', 7),
            ('A', 1),
            ('B', 2);