Most voted "sql-insert" questions
INSERT is the ANSI standard SQL command to insert records into the database.
Learn more…213 questions
Sort by count of
-
10
votes2
answers3515
viewsWhat is the difference of an empty string and NULL in SQL?
What’s the difference of storing a string as NULL or empty in SQL? How these two can behave when I go to make one SELECT, or INSERT worthwhile '' in that column which is of the type varchar? If I…
-
7
votes3
answers2045
viewsInserting record and recovering ID generated by SQL Server 2012
I want to insert a record into a table, recover the ID that was generated by AUTO_INCREMENT and insert records into other tables using this ID. But, I want to do this all using the BeginTransaction.…
-
7
votes2
answers758
viewsWhat does the return of the INSERT 0 1 bank mean?
When I perform commands in the bank I have returns to and execution of the same. Doubt What does the 0 in INSERT 0 1? Example CREATE TABLE test( id SERIAL, name VARCHAR(50), PRIMARY KEY (id) );…
-
6
votes1
answer113
viewsXamarin Forms await is not respected
Good night, someone can tell me why the code below does not respect Wait, in debug the exit order is 1. init save 2. End Save 3. New header ID: 1 instead of: 1. init save 2. New header ID: 1 3. End…
-
5
votes2
answers1861
viewsHow to refresh page and not send duplicate data to PHP database?
I would like to know if anyone has an example or can explain to me in the following question: In case the user refreshes the page, after sending the first form, the data is not sent again to Mysql.…
-
5
votes1
answer11274
viewsHow to insert data into two tables at the same time?
I need to make an insertion as follows: I have two tables TABELA 1 and TABELA 2 and a cadre form. This form has three inputs: input 1, input 2, input 3 The input 1 shall be inserted into TABELA 1.…
-
5
votes2
answers26234
viewsSELECT INSERT in Oracle using Sesquence nextval and group by
Good morning, you guys! I’m trying to make an Oracle select using a SEQUENCE in id, but is giving error on account of a group by no select. Dry up my SQL: INSERT INTO SUP_T(ID, DESCRICAO) SELECT…
-
5
votes2
answers1969
viewsHow to get the Primary key Identity of an inserted record?
I need to create a stored procedure to insert a game into my database. A game relates to a championship through the table campeonatoJogo. The tables are basically: create table jogo( codJogo int…
-
4
votes1
answer356
viewsDatabase Locked Sqlite/Java error
I have the following problem: in an Insert that I am trying to accomplish, I don’t know if it is an error in the database or something in the java programming, but every time I try to perform an…
-
4
votes2
answers1474
viewsIs it possible to do an INSERT and UPDATE in the same query in java?
I wonder if it is possible to make one INSERT and a UPDATE in the same query, that is, in the same operation. I’m using the following to do both operations. public Connection conn = null; ... conn =…
-
4
votes1
answer128
viewsHow to insert records via cursor?
I need to insert unique records by a field that has the unique identifier, so I’m using cursor; however, the unique identifier does not add according to the inserts. ERROR: You are duplicating and…
-
4
votes3
answers98
viewsSort select displaying something at the end after sorting
I have a table called Tabela1 and another call Tabela2: Tabela 1 Tabela2 Indice, pessoa_id sts, pessoa_id The index goes from 0 to 10, and sts can be ON-LINE, OFF-LINE OR ON-LINE-PAUSADO. I wish…
-
3
votes1
answer326
viewsProblems sending FILE to Database
I have a problem sending FILE data to BD. With the help of @Zuul I came to this problem. <?php require("conectar.php"); //chama o arquivo de conexão ao BD if (isset($_POST['Nome'])) { $Nome =…
-
3
votes1
answer240
viewsAdd tag to all repetitions of a given word
Look at the code below: <style type="text/css"> .format{ color: red; font-style: italic; } </style> <div> <p>texto texto texto 'palavra-chave'. texto 'palavra-chave', texto…
-
3
votes1
answer552
viewsInsert data into mysql, commit() does not work
I wanted to enter in the database definitely. But with this code I am not able, the record is saved but does not commit(): import MySQLdb def conn(): try: db =…
-
3
votes1
answer2916
viewsApostrophe causing error when entering data into Mysql
I’m a beginner in PHP and I’m creating a personal project to consolidate my knowledge until I came across a problem, by entering a name that has an apostrophe this apostrophe makes the INSERT INTO…
-
3
votes2
answers293
viewsInsert in mysql with strtoupper not accepting numbers and letters
I am doing the following Insert: <?php include "conexao.php"; $v_tipo = $_POST ["tipo"]; $v_funcao = $_POST ["funcao"]; $v_numero = $_POST ["numero"]; $v_responsavel =…
-
3
votes2
answers1649
viewsOptimize a data transfer from one table to another SQL SERVER
SQL SERVER Database I have two tables, one with 2 billion records and the other with 16 billion. I am copying the first to the second. Using the INSERT INTO table2 SELECT * FROM table1; Doesn’t work…
-
3
votes2
answers2282
viewsError with Insert in SQL Server: The Conversion of a varchar data type to a datetime data type resulted in an out-of-range value
Next I have to do a survey and implement a query in the database using Merge and I have to do it using one of the scripts used in class. The problem is that when I run the script the following error…
-
3
votes1
answer941
viewsCircumvent primary key duplication error
Hello, I have the following script, . sql, to create a table and also create a Trigger. SET client_encoding TO 'LATIN1'; CREATE OR REPLACE FUNCTION before_insert() RETURNS trigger AS ' DECLARE n…
-
3
votes2
answers2038
viewsSQL Insert with line break
With this command SQL enter some data in the table, the problem is, in the system the field "ANDAMENTOS_PROCESSUAIS.OBSERVATION" is with line breaking and at the time of saving via SQL the line…
-
3
votes2
answers155
viewsPerform action before saving?
I’m getting the requests form and putting everything at once to save using the protected $fillable = ['nome', 'idade', 'cep', 'nr_casa']; of Laravel I’m getting it like this: public function…
-
2
votes2
answers888
viewsFormat date (from a txt file) to Insert to Mysql
Follows the code: //informações necessarias para inserir no DB. coo := copy(lTemp,53,6); ccf := copy(lTemp,47,6); ecf := copy(lTemp,4,20); //Data sendo formatada para ser inserida dtc1:=…
-
2
votes2
answers1914
viewsHow to make Insert in tables with many relationship for many?
I’m having second thoughts about how I’m gonna do the Insert relationship n:n my tables are: Recibo Analise Analise_Recibo (recibo_id, analise_id)…
-
2
votes2
answers130
viewsHow to insert 200 new records?
I need to insert new data into a table, but there are many. I did so: insert into pessoafisica (coluna1, coluna2, coluna 30) select (dado1 dado2 dado30) But there are many, can not do 1 by 1.…
-
2
votes2
answers1333
viewsSet default value SQL Server column
I would like to know how to set an Insert pattern in a column in SQL. Example: CREATE TABLE XPTO( ID INT IDENTITY(1,1), NOME VARCHAR(100) NOT NULL, ATIVO CHAR(1) NOT NULL) In this case, I want to…
-
2
votes2
answers4834
viewsHow to check in the database if the registration has already been made PDO
How do I check if the id user no longer has registration in the database and continue with the insert? if(isset($_POST['submit'])){ $comment = trim(strip_tags($_POST['comment'])); $insert = "INSERT…
-
2
votes1
answer74
viewsDoubt - Insert SQL Server 2012 table
I need to insert some information in the table called task, however, only when a certain condition is accepted that in the case of these two date fields, I put it for today for example if it was…
-
2
votes1
answer2174
viewsHow to make an insert with conditions in SQL?
I am trying to make an Insert, a column of which depends on a result INSERT INTO TABELA (ID, (CASE 'opcao1' WHEN 'opcao1' THEN "campo1" WHEN 'opcao2' THEN "campo2" ELSE campo3 END)) VALUES…
-
2
votes2
answers362
viewsmodel and controller in codeigniter for making Insert in Firebird using Generator
I am new to codeigniter and need to define my controller and model, so when calling the model inserir(), the controller takes the last Generator ID of each table you want to do Insert. I’ll give you…
-
2
votes1
answer2668
viewsSql runs on Oracle SQL Developer, but does not run on C#
vsql = @"INSERT INTO ALUNOS_ (UF, IDADE, TELEFONE, NOME_PAI, ENDERECO, EMAIL, NOME, CIDADE, NOME_MAE) values ('sp', 0,'','','','','','','');"; This SQL when running on oracle does the insertion but…
-
2
votes2
answers213
viewsInsert multiple lines into Informix
I use a Informix bank and I have to do 3500 Inserts. Informix runs line by line and this is impractical. How do I insert all lines at once? Example: insert into tabela (coluna1, coluna2, coluna3)…
-
2
votes1
answer46
viewsHow to create records in the MYSQL table according to the value of the $nregistros PHP variable
I have a $nregistros variable that defines the value of records to be inserted in the table "Formularios". If $nregistros is equal to 4 for example, it should insert 4 rows as follows: formularios…
-
2
votes2
answers485
viewsINSERT INTO with Mysql filter
I am trying to create an INSERT INTO in an X table by making a filter in table Y, but I get a syntax error. I’ve researched what could be wrong, but not found. INSERT INTO products ( SELECT * FROM…
-
2
votes3
answers391
viewsInsert multiple mysql checkbox records
are trying to enter in the database information of multiple checkbox at once , for example a news is related to more than one category then and only select the categories and save , however this…
-
2
votes1
answer350
viewsHow to concatenate a variable plus a message in the "Insert"?
Concatenate a variable and a message in the insert? Example: declare a int; set a = 2; insert into tb_usuario values ('a' + 'fez tal coisa');
-
2
votes1
answer88
viewsDo Not Insert PHP and MYSQL Equal Values
I have a PHP and Mysql script that searches the client table for all clients that have not yet been imported to another database/table and imports. In the customer table, there’s a flag imported…
-
2
votes1
answer6778
viewsThe INSERT statement conflicted with the FOREIGN KEY C#
I have this code to insert values into a table: conn.Open(); comm.CommandText = @"INSERT INTO ArticleBarCode(Code, Code_Article, BarCode, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn, IsDeleted)…
-
2
votes3
answers1512
viewsHow to do so, if the record exists, it updates, if it does not do an Insert of the same
I am a beginner in the forum and in php and I have a question. I have a table with id auto_incremento and name is primary key. There is how I do IF and ELSE using UPDATE and INSERT. Where, if there…
-
2
votes1
answer593
viewsInsert data from an array into the database by Codeigniter
I’m trying to make a INSERT using Codeigniter and would like to know if there is a more practical form than the one used below: MODEL public function set_cliente() { $dados = array( 'codigo_cliente'…
-
2
votes2
answers1017
viewsMultiple insert with php PDO and Mysql
My situation, A post form with a text input and two radios inputs. Inputs are named respectively, nome[0] and tipo[0]. When one adds more form fields I put one .attr to stay nome[1] and tipo[1]" and…
-
2
votes1
answer218
viewsInsert Mysql syntax error
I can’t resolve the error below: Notice: Undefined index: Html_cor_task in C: Users User Desktop pi Fe Order2 Cadastrataefa.php on line 14 You have an error in your SQL syntax; check the manual that…
-
2
votes1
answer1085
viewsInsert into related tables
Eai personal, to create an SQL for Insert in related tables, are the following tables: tb_Customer(id_Customer INTEGER [PK], nm_Customer VARCHAR, cpf_cnpj NUMERIC) dm_address_type(cd_address_type…
-
2
votes1
answer7523
views(Mysql) Insert or Update in the database
I need to perform one Insert in the database, if there is no Cpf of a person. if there is it has to do a Update. But all this through a single script on Mysql. I illustrated the example below as I…
-
2
votes1
answer113
viewsQuery execution after a few seconds
I have a script that records all the views of the pages of my site that I downloaded, and it’s working very well. Only now some problems have arisen in what it comes to GOOGLE visitation, and has "a…
-
2
votes1
answer110
viewsInsert cloned items into the form with PHP and Mysql
Friends, I’m having trouble recording cloned Mysql fields in the form. I’ll try to explain in detail to see if my friends can help me. <div class="mb-md"> <a href="#" id="but_add"> <i…
-
2
votes4
answers674
viewscode of the PHP page appearing when clicking the Submit button of the form
On my html page I have the following form: <form method="POST" action="index.php" class="header"> <label for="km_tdo" id="lbTdo">KM troca de óleo:</label><input…
-
2
votes2
answers103
viewsInsert value in Table Y for all existing Table X Ids
I have a table called CONTAS with a column account_id. I have another table called PREMIO with columns account_id, id_premio and itemqtd I wanted a command where I inserted the id_premio and itemqtd…
-
2
votes1
answer55
viewsInserting CSV into Postgresql with Nodejs
I want to insert a CSV into a postgresql table. CSV contains rows with multiple column numbers. Ex: 1,2,3 1,2,3,4,5 1,2,3,4,5,6 1,2,3,4 When performing the insertion, the following error occurs:…
-
1
votes1
answer114
viewsData insertion with PHP OO (Similar to Entitymanager.persist (Object) java manager)
I would like a tip on how to loop to insert an object into the mysql/ postgres database ... Example class User { // PRIMARY KEY public $id; public $login; // PRIMARY FOIREIGN KEY public $people;…