Questions tagged as 'sql'

2
answers

Turning rows into columns in SQL [duplicate]

I have the following Query: SELECT distinct finmovem.num_transacao ,finempe.codigo_orgao ,finempe.cod_reduzido ,finempe.num_empenho ,finempe.data_empenho ,finempe.nome_fornecedor ,finempe.valor_...
asked by 12.04.2018 / 18:40
2
answers

Problems doing simple insert in the bank - Unexpected Token

I'm having trouble inserting into the database, could anyone tell me what the possible problems are? SQL 1: INSERT INTO data_inicio (data_sys, descricao) VALUES (NOW(),'Data de inicio'); Error in sql: Unexpected token near 'Start date'...
asked by 19.04.2018 / 16:08
1
answer

Command similar to sql convert in C #

I have a return in sql that comes as something like 52,451541554 . This return, if I convert it with the command convert(datetime, DtCriacao, 103) of sql it turns into a date format, but I need to get it myself, which this time...
asked by 04.04.2018 / 13:40
1
answer

Percentage in SQL

I have the following query code: SELECT AC.DT_AGENDA AS DATA, ME.DS_MULTI_EMPRESA AS EMPRESA, AC.CD_UNIDADE_ATENDIMENTO AS CD_UNID_ATENDIMENTO, UA.DS_UNIDADE_ATENDIMENTO AS UNIDADE_ATENDIMENTO, COUNT...
asked by 26.04.2018 / 21:20
2
answers

SQL subqueries with counter

I have a table like this: ++++++++++++++++++++++++++++++++++++++++ + Nome | Cargo | Estado + + ++++++++++++++++++++++++++++++++++++++ + Joao | Estagiário | RJ + + Maria | Analista | RJ + + Thiago| Ge...
asked by 24.03.2018 / 18:11
2
answers

Trigger condition

About the following trigger: CREATE TRIGGER [dbo].[TG_TESTE] ON [MINHABASE].[dbo].[TB_DOCUMENTOS] AFTER UPDATE AS DECLARE @ID INT DECLARE @DOC INT DECLARE @QTD FLOAT SELECT TOP 1 @ID = ID, @DOC = DOCUMENTO, @QTD = QUANTIDADE FROM d...
asked by 24.04.2018 / 13:41
2
answers

Calculate time difference

Hello friends, how are you? So I have the following problem that I had never solved before and I do not even know where to start. I am creating a scheduling system I have the table from above for config in this scheme I have 3 rooms, the o...
asked by 24.04.2018 / 16:40
4
answers

Fill in a datatable from a txt

I have a datareader writing directly to the text file, int count = dataReader.FieldCount; while (dataReader.Read()) { for (int i = 0; i < count; i++) {...
asked by 22.03.2018 / 17:03
1
answer

Trigger with sum between dates

Good Night, I need help that I can not get, I have two tables in my db. 1 - Portfolio table composed of: CREATE TABLE 'carteira' ( 'id' int(11) NOT NULL, 'datat' datetime DEFAULT NULL, 'vl_cliente' decimal(10,2) DEFAULT NULL )...
asked by 12.05.2018 / 01:01
1
answer

Listing based on query in bank

First of all, I apologize if the question is vague, since it is a very broad topic. Today I have a system of registration and consultation of students, where the query is made exclusively by CPF, since it is a unique identifier and a constrai...
asked by 23.03.2018 / 19:07