sqlinsertdatetime2

How can I have two date variables in datetime2 type in sql?


I want to insert these values into existing table.

insert Schedule
    ([Title], MeetingTime)
values
    (N'First meeting', ('2018-10-9 18:30:00' and '2018-11-13 18:30:00' )),
    (N'Second meeting', ('2018-11-6 18:00:00' and '2018-12-4 18:00:00' ))
==================================
[Title] NVARCHAR(32) not null
MeetingTime DATETIME2 not null

I used and, but it is incorrect syntax. How can I have two or more values in DATETIME2 type?

Thanks in advance!


Solution

  • insert Schedule
    ([Title], MeetingTime)
    values
    (N'First meeting', '2018-10-9 18:30:00'),
    (N'First meeting', '2018-11-13 18:30:00'),
    (N'Second meeting', '2018-11-6 18:00:00'),
    (N'Second meeting','2018-12-4 18:00:00' );
    

    This is assuming that Title is not the table unique key.