I have created a table that stores numberplates in SQL. The table looks like this:
CREATE TABLE tblCar
(
VehicleRegNo VARCHAR(10)PRIMARY KEY NOT NULL CHECK(VehicleRegNo>0),
Make VARCHAR(50) NOT NULL,
EngineSize VARCHAR(10) NOT NULL,
DateRegistered DATE NOT NULL,
RentalPerDay MONEY NOT NULL,
Available CHAR(1)NOT NULL
);
I also have used a statement that is:
SELECT LEFT(NEWID(),8)
I can generate random numbers and letters with this statement but I am unsure of how to insert it into my table.Should I declare a variable or is this a suitable way. The VehicleRegNo column will store the numberplates.