Self defined field? SQL Server -



Self defined field? SQL Server -

i'm getting started on sql server , have little problem need "license" column "clients" table self defines it's cells follows: auto incremented number + "-" + 3 lastly numbers of "id" + 'f' if "gender"='female' or "m" if "gender"='male' ideas?

you can utilize computed column purpose

here how can added autoid auto inremented number can used in computed column.

create table table1 ( autoid int identity(1,1), id int, gender varchar(5), license cast(autoid varchar(20))+ '-' + cast(id%1000 varchar(20))+ (case when gender ='female' 'f' else 'm' end) )

sql sql-server sql-server-2008-r2 sql-server-2012

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -