-3

The table has a date data type column. Not sure why the error message keeeps coming up.

INSERT INTO Worker (WORKER_ID, FIRST_NAME, LAST_NAME, SALARY, JOINING_DATE, DEPARTMENT) 
VALUES (001, 'Monika', 'Arora', 100000, '14-02-20 09.00.00', 'HR'),
       (002, 'Niharika', 'Verma', 80000, '14-06-11 09.00.00', 'Admin'),
       (003, 'Vishal', 'Singhal', 300000, '14-02-20 09.00.00', 'HR'),
       (004, 'Amitabh', 'Singh', 500000, '14-02-20 09.00.00', 'Admin'),
       (005, 'Vivek', 'Bhati', 500000, '14-06-11 09.00.00', 'Admin'),
       (006, 'Vipul', 'Diwan', 200000, '14-06-11 09.00.00', 'Account'),
       (007, 'Satish', 'Kumar', 75000, '14-01-20 09.00.00', 'Account'),
       (008, 'Geetika', 'Chauhan', 90000, '14-04-11 09.00.00', 'Admin');
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    What is the **structure** of that table? What datatype and length/precision/scale are those columns in the table? Without that information, no one will be able to help you ... – marc_s Aug 13 '23 at 15:43
  • 4
    Use an [ISO 8601 datetime format](https://stackoverflow.com/questions/813238/tsql-datetime-iso-8601). – Dan Guzman Aug 13 '23 at 15:53
  • 1
    What is `14-02-20 ` meant to represent? The 20th day of the 2nd month of the 14th (0014, 1914, 2014?) year? The 14th day of the 2nd month of the 20th (0020, 1920, 2020?) year? Perhaps even the 2nd of 20th/14th month (eh?) of 0014/0020? It's completely unclear and ambiguous. – Thom A Aug 13 '23 at 17:11
  • Also if it has a `date` data type column why are you providing a date *and time* value? `date`, as it's name implies, can only store a *date*; it can't store a time portion. You likely want a `datetime2(0)`. – Thom A Aug 13 '23 at 17:17
  • 1
    Also `09.00.00` is not a valid format for time. Garbage in, garbage out. – Stuck at 1337 Aug 13 '23 at 17:20
  • Thank you for your response. I correctede both the Date format and the time format. I have been able to successfully create the table. – Oladotun Ojo Aug 13 '23 at 19:39

0 Answers0