[quoted text, click to view] >> Hi need a stored procedure to replace the 4 commands listed below <<
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.
Also, learn to describe your problem instead of the solution you want
to force to work. For example, any RDBMS person seeing a column
called "total_cost" knows that your whole schema is a nightmare.
Let's all say it together, from the 4-th week of our DB Design course
--"Never store a computed value in a row!" We put them in a VIEW.
Also, we do not model forms in RDBMS -- we model facts. Forms are
paper or screens that capture whole or partial facts. That was the 2-
nd or 3-rd week of class.
CREATE TABLE Bookings
(booking_date DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL
CHECK (booking_date = DATEADD(d, DATEDIFF(d, 0, booking_date),
0)),
mileage_charge DECIMAL (8,4) NOT NULL
CHECK (mileage_charge >= 0.00)
waiting_charge DECIMAL (8,4) NOT NULL
CHECK (mileage_charge >= 0.00)
car_park_charge DECIMAL (8,4) NOT NULL
CHECK (mileage_charge >= 0.00),
etc,);
[quoted text, click to view] >> WHERE allocated = COMPLETED AND TimeOfBooking BETWEEN '" + getdate(), "'", > "''" + " 00:00:00' AND '" + getdate(), "'", "''" + " 23:59:59' <<
Why are you using the proprietary getdate() when the Standard
CURRENT_TIMESTAMP is supported? And why are you using them
incorrectly? Can you explain what was allocated and what was
completed?