0
I am using the SQL Server Management
and I’m trying to create
a table that has the ID
which must be auto-incremented.
However, I can’t use the property IDENTITY
, and do everything in script
, on the same hand.
I wonder how I can do this, since (for example) it does not work like this (as it is for Mysql):
CREATE TABLE Persons (
ID int NOT NULL AUTO_INCREMENT,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);
I don’t get it, you want him to be
Identity
or want to create something to add value according to a special rule?– Jeferson Almeida
I want to make the property Identity "by hand", without using the property itself, and rather program what it does. Would I have to use create table and alter table, maybe? I’m not sure because I’m a database beginner
– Bellon
Without using the autoincrement provided by the database you would need to control this ID creation within your application.
– Marcell Alves
@Marcellalves not necessarily, you can do this via bank tb
– Jeferson Almeida
@Jefersonalmeida, how could he do via bank? Post an answer with this solution, because it is what the user is needing.
– Marcell Alves