Questions tagged as 'sql-server'

2
answers

How to make a query that just counts an unbroken stream?

I want to count uninterrupted values of the current year back until the first NULL occurs. Example:    Several people make donations to an NGO annually and this is   stored in a database, I would like to know how many years a   pers...
asked by 30.11.2017 / 13:34
1
answer

Relationship 1: N check date, difference 6 month

I'm developing a SQL Server procedure, which lists two tables: WhereaprocesshasN-statements,Ineedtoreturnthefollowingdata:allProcessNumbersthatarewiththeIrrecuperavel(int)=1columnandthe"last" date entered in the Process table for that% Proce...
asked by 28.11.2017 / 17:10
1
answer

Extract Free Text Field Dates

I'm running a query in a view, but one of its fields is text, in this field the user can enter a date (xx / xx / xxxx) as well as any other type information. I would like to know how I can return only the records I can convert to date or how can...
asked by 20.09.2017 / 19:58
2
answers

Dateadd Hours - SQL Server

Everyone, I have a question. In the query below, in the field titling, he counts the hours normally, however, I want you to count only the working hours. NOTE: You already have a working hours function called working_hours NOTE: This variable...
asked by 06.11.2017 / 21:19
2
answers

Result Null Coming in query

Good morning, I need a help from you, I have a query on my system that has a problem, it has 4 results, only 1 of those 4 is coming with null value. I'm going to post my query below SELECT Title, SUM(Count) AS Count FROM ( SEL...
asked by 18.09.2017 / 15:35
1
answer

ID of tables out of order

I have a table with 9 records, my identities are in the order of 1 to 9, when I insert a new record in the table automatically a new ID is set, but it is set to the value 30 instead of with the next number which in this case would be 10 (I have...
asked by 10.08.2017 / 14:33
2
answers

Paste previous record - SQL Server 2012

I need to bring only the records where the previous status was 1 , but which is currently 0 . I have a table named solicitação that contains a field called VencimentoPausado , where this field values are 1 or...
asked by 06.08.2017 / 19:57
1
answer

Change existing column to Identity

Having an entity where the first key is an integer and is set to not be a Identity public class Teste { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; set; } public string Nome { get; set;...
asked by 07.08.2017 / 16:07
2
answers

Adds WITH query within another query

People, like adding the query below as a subquery. Query with WITH : WITH tabela (projeto, operadora) AS ( SELECT p.projdesc, tt.tartitulo FROM tarefa tt INNER JOIN projetos p ON p.projid = tt.projid...
asked by 04.08.2017 / 21:09
1
answer

How to delete or hide the password typing of data access from a server running SQL Server from VBA or Excel macro?

I am performing a migration service from a database with a SQL Server server in a company, but have asked me to intermediate the migration in Excel Spreadsheets, because they want so in this first phase to advance some treatments in same work...
asked by 29.06.2017 / 05:06