SQL Server: Auto increment decimal column -


i need auto increment decimal column in sql server 2014.

you should tell want achieve, 1 way emulate auto-incremented decimal column define computed , connected auto-incremented normal (integer) column. e.g.:

definition:

create table autoincrementdecimaltest (     id int not null identity(1, 1),     sometext nvarchar(200) not null,     -- may declare persisted, if space not problem     autoincrementdec cast(id * 0.2 numeric(18, 2)) ) 

of course, limitations apply expression, pointed out here.

testing:

insert autoincrementdecimaltest (sometext) values ('test1'), ('test2') go  select * autoincrementdecimaltest go 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -