Failed to execute statement in SQL Server 2008 [duplicate]

0

I need to run this MYSQL statement in SQLServer

CREATE TABLE venta (
  idVenta INTEGER PRIMARY KEY, 
  Fecha DATE NOT NULL, 
  Cliente_Cedula INTEGER NOT NULL,
  producto_idProducto INTEGER NOT NULL,
  empleado_Cedula INTEGER NOT NULL,
  cantidad INTEGER NOT NULL,
  FOREIGN KEY ([Cliente_Cedula])
    REFERENCES cliente ([Cedula])
    FOREIGN KEY ([empleado_Cedula])
    REFERENCES empleado ([Cedula])
    FOREIGN KEY ([producto_idProducto])
    REFERENCES producto ([idProducto])
  );

I get the following error message

Sintaxis incorrecta cerca de la palabra clave 'FOREIGN'.

Anyone here would be kind enough to tell me that I am doing wrong in the sentence?

    
asked by Sebastian Salazar 02.03.2018 в 18:14
source

1 answer

2

Must work in SQL Server:

CREATE TABLE venta (
  idVenta INTEGER PRIMARY KEY, 
  Fecha DATE NOT NULL, 
  Cliente_Cedula INTEGER NOT NULL FOREIGN KEY REFERENCES cliente ([Cedula]),
  producto_idProducto INTEGER NOT NULL FOREIGN KEY REFERENCES producto ([idProducto]),
  empleado_Cedula INTEGER NOT NULL FOREIGN KEY REFERENCES empleado ([Cedula]),
  cantidad INTEGER NOT NULL
  );
    
answered by 02.03.2018 / 19:11
source