SMALLDATETIME Data Type - SQL Server to MySQL Migration

In SQL Server, the SMALLDATETIME data type stores date and time values with minute-level accuracy (seconds are always 00).

In MySQL, you can use the DATETIME data type along with an expression to set the seconds to 00.

SQL Server:

  -- Sample table 
  CREATE TABLE products
  (
    name VARCHAR(30),
    created_dt SMALLDATETIME
  );
 
  INSERT INTO products VALUES ('Apple', GETDATE());
 
  -- Seconds are set to 00
  SELECT created_dt FROM products;
  /* 2026-01-14 16:28:00 */

MySQL:

  -- Sample table 
  CREATE TABLE products
  (
    name VARCHAR(30),
    created_dt DATETIME
  );
 
  -- Use an expression to set seconds to 00 
  INSERT INTO products VALUES ('Apple', CAST(DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:00') AS DATETIME));
 
  SELECT created_dt FROM products;
  /* 2026-01-14 16:28:00 */

For more information, see SQL Server to MySQL Migration.