Questions tagged as 'sql-server'

3
answers

SQL Server - Query logic

Look at the result below: This is the result of the following query: select *, isnull(h,isnull(f,isnull(d,isnull(b,isnull(a,0))))) as y1, isnull(h,isnull(g,isnull(f,isnull(e,isnull(d,isnull(c,isnull(c,0))))))) as y2 from valor My...
asked by 01.07.2018 / 01:25
1
answer

What I need is to get the primary key from the Phone table and insert into the FK of the Customer table. How do I do?

CREATE TABLE Cliente ( id_Cliente INTEGER PRIMARY KEY IDENTITY(1,1), nome_Cliente VARCHAR(50), fk_ID_Telefone INTEGER ) CREATE TABLE Telefone ( id_Telefone INTEGER PRIMARY KEY IDENTITY(1,1), fone_Telefone VARCHAR(11) )     
asked by 11.05.2018 / 16:48
2
answers

Merge results from several procedures into a single table

I have the following procedure where I pass the name of a column and it counts the records of that column. exec psGraficoestatistica 'Email' It returns a column with the name EMAIL and a single line with the number of occurrences....
asked by 04.02.2015 / 14:55
2
answers

How to separate records into blocks for parallel processing?

I have a table in SQL Server that makes the control of messages to be sent and a routine in C# , configured in a Cron, that selects the pending messages, sends and marks as sent. What I'm implementing is the ability to configure...
asked by 20.04.2018 / 21:18
2
answers

Previous dates

I am reporting where I need to always pick up the customer registration date in a previous month. Example: I am in the month of December 2017, I want to pick up the customers that were registered from November 1st 1 to the last day of November;...
asked by 27.12.2017 / 12:41
3
answers

Find greater sum value and show id

Talk about it, all right? I have this table EMPLOYEE_PROJECT Table +--------------+-------------+-------+ | rg_empregado | num_projeto | horas | +--------------+-------------+-------+ | 20202020 | 5 | 10 | +---------...
asked by 13.04.2016 / 16:22
3
answers

Sql Server Agent (SQLEXPRESS) on local computer started is stopped?

Hello, I have a machine with windows 10 I installed SQL Server normally, it was working, but now SQL Server does not start, I went to the service manager and when I try to boot I get the message: The Sql Server Agent (SQLEXPRESS) service o...
asked by 01.09.2015 / 21:52
1
answer

Combobox does not return columns from SqlServer

In the following code, it should present me the columns of a table that I have in my system, but when clicking to display the options in the combobox nothing appears. However, if I start typing the name of the field, for example, Name_ it is com...
asked by 05.11.2015 / 19:25
3
answers

Add time column in SQL SERVER

I have a column of type time in a table. With records like: 00:02:15 00:09:47 00:00:25 ... I need, in my select , to get the sum of those minutes in time format . Return example: 00:12:27 I have tried in many ways without succ...
asked by 06.03.2018 / 12:12
3
answers

operation with date sqlserver

Gentlemen, I'm migrating my system from Oracle to SQL Server, I'm having trouble doing the following operation SELECT CASE WHEN (EPL.DAT_VENCIMEN - EPL.DAT_FABRICA) > 0 THEN CAST(((CAST(SYSDATE-EPL.DAT_FABRICA AS INT)) /...
asked by 11.10.2016 / 16:21