SQLTeam.com | Weblogs | Forums

MSSMS Error Conversion failed

I am creating database and I got an error

Conversion failed when converting date and/or time from character string

This is the table I created :

*USE A20762_AK1DS_Projekt

CREATE TABLE Priestupky
(
id_Priestupku int,
id_Občana int,
id_Zamestnanca int,
dátum_spáchania_priestupku date,
Zápis_v_trestnom_registry date,
id_Trestnej_sadzby int,

PRIMARY KEY (dátum_spáchania_priestupku),

FOREIGN KEY (id_Občana) REFERENCES Občania_SR (id_Občana) 
    ON DELETE CASCADE,
CONSTRAINT fkid_Občana 
    FOREIGN KEY (id_Občana) REFERENCES Občania_SR (id_Občana),
FOREIGN KEY (id_Zamestnanca) REFERENCES ZAMESTNANCI (id_Zamestnanca) 
    ON DELETE CASCADE,
CONSTRAINT fkid_Zamestnanca 
    FOREIGN KEY (id_Zamestnanca) REFERENCES Zamestnanci (id_Zamestnanca),
FOREIGN KEY (id_Priestupku) REFERENCES Register_priestupkov (id_Priestupku) 
    ON DELETE CASCADE,
CONSTRAINT fkid_Priestupku 
    FOREIGN KEY (id_Priestupku) REFERENCES Register_priestupkov (id_Priestupku),

);*

I am filling in data with this values SQL:

*INSERT INTO Priestupky (id_Priestupku , id_Občana, id_Zamestnanca, dátum_spáchania_priestupku, Zápis_v_trestnom_registry, id_Trestnej_sadzby)
VALUES (1, 2, 7, '20210303' , '20210303', '01'),
(2, 3, 9, '20190102', '20190102', '02'),
(3, 4, 8, '20200605', '20200605', '03'),
(4, 5, 6, '20170404', '20170404', '04'),
(5, 6, 5, '20160606', '20160606', '05'),
(6, 7, 4, '20080802', '20080802', '06'),
(7, 9, 3, '20100601', '20100601', '07'),
(8, 10, 2, '20110503 , 20120403', '20110503', '08'),
(9, 11, 1, '20010201', '20010201', '09'),
(10, 12, 10, '20140303', '20140303', '10'),
(11, 14, 11, '20160404', '20160404', '11'),
(12, 15, 12, '20200303, 20210404', '20200303', '12'),
(13, 16, 13, '20150503', '20150503', '13'),
(14, 17, 14, '20020608', '20020608', '14'),
(15, 18, 15, '20130603', '20130603', '15'),
(16, 19, 16, '20160606', '20160606', '06');
*

Do you have idea how can I resolve this? Thank you for your answers and advice.

Try it using suggestion here

And reading about try_convert. It will help you learn

Also look into CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Docs

for different date formats you can use. show us what you tried and then where you stuck after reading the above.