How to assign unique starting value to Identity Column's starting value [SQL Server 2014] -


this question has answer here:

for example, have userid column identity column of table. when add new data table, userid assign 1 automatically. if enter new data, number in column increases 1 one.

userid - username - userlastname 1        asd        asd 2        xyz        xyz 

i want change userid's starting value , increase condition.

userid - username - userlastname us1        asd        asd us2        xyz        xyz 

is possible increase string values above ?

if using oracle database, can create trigger that.

 create or replace trigger "system".trigger_name      before insert on table_name      each row      begin       <<column_sequences>>       begin         if inserting , :new.userid null           select 'us'||to_char(sequence_name.nextval,'fm00') :new.userid sys.dual;         end if;       end column_sequences;     end; 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -