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.
Member
1 Points
8 Posts
Why am I getting this error message when I go to execute my query?
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?
All-Star
52971 Points
23573 Posts
Re: Why am I 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.
https://support.microsoft.com/en-us/help/283878/description-of-the-database-normalization-basics
https://docs.microsoft.com/en-us/sql/lp/sql-server/database-design?view=sql-server-ver15#pivot=products&panel=products1
Contributor
3140 Points
983 Posts
Re: Why am I getting this error message when I go to execute my query?
Jan 13, 2020 09:19 AM|Yang Shen|LINK
Hi Joe_p123,
Seems you are inserting values to identity field
[Booking ID]
.An 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:
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.
Best Regard,
Yang Shen