Questions tagged as 'sql'

1
answer

MySQL error: # 1265 - Truncated data for column 'value' on line 1

Good afternoon, guys. I gave the following command in MySQL: UPDATE procedimentos SET valor = '2.400.00' WHERE procedimentos.id_proced = 1 The value field is a double , I already tried with float and gave the same error, what exactly wou...
asked by 05.02.2018 / 15:55
1
answer

Problems with executescalar (System.Data.SqlClient.SqlException)

I have the following code block: sqlConn.Open(); SqlCommand inserirAluno = new SqlCommand("INSERT INTO ALUNOS (Nome, DataNascimento, CPF, Endereco, Bairro, " + "CEP, Cidade, IdEstado, Sexo) OUTPUT INSERTED.ID" +...
asked by 12.03.2018 / 23:09
2
answers

Add SUM () in the querry results

I have this querry that gives me the total nr of rows that start with the same code USE CCILCDatabase; GO DECLARE @mes int; SET @mes = 1; WHILE (select @mes) <= 12 BEGIN SELECT LEFT(CONVERT(VARCHAR(10),[CPVCodeID]),2), COUNT...
asked by 02.02.2018 / 18:45
1
answer

Select result, and only show if all are equivalent

I'm servicing a database, and I have the following situation; in the database I have 5 columns in a table, they are:    ID (PK) | IDBillet | Result | Borrowed | Date | I have to filter for the user to see, only the IDBilhete that is missi...
asked by 01.02.2018 / 15:34
2
answers

How to export a SQL table to a .txt file?

Good morning! I need to insert the return data of a Select into a .txt file containing the column names and separating the data with ";" How can I do this? Thank you in advance     
asked by 06.02.2018 / 13:46
1
answer

Error creating foreign key

I'm creating two foreign key references pointing to two different tables, but I'm getting an error creating one.    There are no primary or candidate keys in the referenced table   'dbo.TB_PODERES' that match the referencing column list in th...
asked by 22.01.2018 / 14:39
2
answers

Select highest value from the most recent date

I have a estoque table where records of all supplies are stored, with the stock-in date , the supply code , and unit value of the part, my need would be to get the highest unit value of the most recent date of each supply: Data...
asked by 08.02.2018 / 14:24
1
answer

Customize SQL query output

How do I customize an output of a SQL query example result of a sum of the columns OUTPUT: 23000 wanted to customize only that output to $ 23,000     
asked by 08.02.2018 / 18:42
1
answer

How to get value from a SQL in php?

I have the following code <?php $buscaValorTotalSaldoInicial=$pdo->prepare('SELECT SUM(valor) AS vTotal FROM saldo WHERE data=:data...
asked by 16.01.2018 / 01:46
1
answer

Split between values - Query SQL Server 2012

Galera, in the query below, is as follows. Ano Mes Horas total_horas 2018 1 107 766 H 2018 1 225 766 H So, I want you to bring in another column the division of the column "Hours" by the column "total_horas", bringing this...
asked by 17.01.2018 / 14:15