Last post Jan 13, 2020 09:19 AM by Yang Shen
Jan 11, 2020 12:50 PM|Joe_p123|LINK
Does anyone know why I'm getting this error message when I go to execute my query?
Jan 11, 2020 02:14 PM|mgebhard|LINK
You've configured the BookingID column as a primary key and Identity column. Just remove the first '1' from the insert. However, there are other issues with the INSERT and design. Date data is not a proper date format, time slot should be two columns;
start and end, Price should be currency.
I recommend learning proper database table design; normalization.
Jan 13, 2020 09:19 AM|Yang Shen|LINK
Seems you are inserting values to identity field [Booking ID].
identity filed means it will grow automatically based on its seed and increment, its value can not be set unless you SET Identity_insert.
In my opinion, you can just ignore its value:
insert into dbo.booking values('1','1','19 12 20','07:00 - 17:00','Morning f12+2')
For more information about insert in SQL Server: The SQL INSERT INTO Statement.
In addition, please mark the post which helped solve your problem as the answer so that it could help more people who met the same problem.