Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

create table sql server auto increment primary key


/* mysql server */
CREATE TABLE persons (
    id int NOT NULL AUTO_INCREMENT,
    colour varchar(191) NOT NULL,
    created datetime, 
    modifed datetime
);

/* sql server IDENTITY*/
CREATE TABLE persons (
    id int IDENTITY(1,1) PRIMARY KEY,
    colour varchar(191) NOT NULL,
    created datetime, 
    modifed datetime
);

INSERT INTO persons (colour, created, modified)
VALUES ('red','2022-08-05', '2022-08-05'),
VALUES ('green','2022-08-05', '2022-08-05'),
VALUES ('blue','2022-08-05', '2022-08-05');
 
PREVIOUS NEXT
Tagged: #create #table #sql #server #auto #increment #primary #key
ADD COMMENT
Topic
Name
8+7 =