Amazing User
Amazing User

Reputation: 3563

Error converting date or time from character string

I want to inserd data to my DB and I have 2 errors:

1)

insert EmployeesInfo
(ID, MartialStatus, BirthDate, [Address], Phone)
values
(1, 'Не женат', '08/15/1970', 'Викторкая 16/7', '(067)4564489'),
(2, 'Женат',    '09/09/1985', 'Малинская 15', '(050)0564585'),
(3, 'Не женат', '12/11/1990', 'Победы 16, 145', '(068)4560409'),
(4, 'Не женат', '01/11/1988', 'Антонова 11', '(066)4664466'),
(5, 'Замужем',  '08/08/1990', 'Руденко 10, 7', '(093)4334493'),
(6, 'Замужем',  '01/10/1994', 'Просвещения 7', '(063)4114141')
go

Error converting date or time from character string.

2)

insert Stocks
(ProductID, Qty)
values
(1, 20),
(2, 10),
(3, 7),
(4, 8),
(5, 9),
(6, 5),
(7, 12),
(8, 54),
(9, 8),
(10, 7)
go

INSERT statement conflict with FOREIGN KEY constraint "FK__Stocks__ProductI__6FE99F9F". The conflict occurred in the database 'InternatShopDB', table 'dbo.Products', column 'ID'.

enter image description here

Upvotes: 0

Views: 52

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269753

Error converting date or time from character string.

Use standard datetime formats. Either '19700815' or '1970-08-15'.

INSERT statement conflict with FOREIGN KEY constraint "FK__Stocks__ProductI__6FE99F9F". The conflict occurred in the database 'InternatShopDB', table 'dbo.Products', column 'ID'.

Make sure that every product that is inserted into the stocks table exists in the products table. Unrecognized products will cause an error.

Upvotes: 1

Related Questions