Questions tagged as 'auto-incremento'

1
answer

Property containing only the KeyAttribute attribute resulting in a self-incrementing column in the database

If I'm not mistaken, this must have come in version 6.1.1 of EntityFramework and it was not like that in previous versions. I believe that a column only became auto-increment when the DatabaseGenerated attribute was declared with the...
asked by 13.10.2014 / 21:53
1
answer

How to insert UUID automatically in a MySQL colum?

Is there any way to insert a UUID automatically into a table field, just as it does with a field of type AUTO_INCREMENT ? In a framework for PHP, CakePHP, when we set the primary key to VARCHAR(40) , it inserts a UUID...
asked by 25.02.2015 / 19:56
2
answers

Auto increment ID value

In my MySQL Workbench I have 4 tables with the auto increment id. But when I fill in the form it adds non-consecutive values. For example: I fill in a form for the first time and the ID it puts me is 3. I want the Id to be followed....
asked by 12.02.2014 / 12:28
2
answers

Doubts increase $ i + loop for

Colleagues, sometimes I come across some snippets in the code used by the $ i variable before the loop ($ i = 0) and in the middle and the end $ i ++, as shown below: Ex1) $c = count($obj); $i = 0; //aqui for ($j = 0; $j < $c; $j++) {...
asked by 03.07.2015 / 18:34
1
answer

Unexpected result in C program

In this code: #include <stdio.h> #include <stdlib.h> int main() { int x, y = 10; //incrementa depois atribui y = ++x; printf("x = %d\n", x); printf("y = %d\n", y); system("pause"); return 0; } Compiled and executed in codeblock...
asked by 11.05.2015 / 13:48
1
answer

Redo autoincrement in SQLite

I'm passing data from an old bank to a new bank. After executing all querys there were some primary key fields that were "missing". Example the id column jumped from die '11' to '13' since die '12' was deleted. This occurs in several ca...
asked by 12.06.2016 / 22:34
0
answers

Auto increment ID relative to another field

Some time ago I was looking for something to solve this problem that I have encountered in other systems that I have developed, I would like to know a solution for how to do an auto increment id, but an auto increment related to another field, f...
asked by 23.08.2016 / 13:30
1
answer

How to reset the auto_increment value (NO TRUNCATE)?

How can I reset / restart the value of AUTO_INCREMENT in Mysql , without using TRUNCATE ? In some cases, it is not possible to use TRUNCATE table in some tables.     
asked by 24.08.2015 / 14:38
1
answer

How to generate sequential numbers automatically with current year in rails?

I need when a new product is created it generates a number ex: 0001/2015 number / year_vigente and when change of year returns to zero. I made a helper just to format the number in the views, but it does not solve the problem of automatic gen...
asked by 15.05.2015 / 21:26
1
answer

How to change a primary key for constraint Auto_increment

I've created the following table create table if not exists cursos( nome varchar (30) not null unique, descicao text, carga int unsigned, totaulas int, ano year default '2018' )default charset = utf8; After adding a PK alter table curs...
asked by 28.11.2018 / 13:46