Questions tagged as 'sql-server'

1
answer

Add Column on SQL server

I'm working on a system that needs to perform a sum that will be done in a SQL Server view. In C # I know how to solve this. I would like to resolve using SQL. ColA ColB 200911 1634,50 200911 558,29 200911 2446,66 200911 2860,90 200911...
asked by 29.11.2014 / 22:36
2
answers

CURSOR vs table-type variable

I'm facing one of those situations where I need to perform an action for each row resulting from a query. In this way I have two options, to use a Cursor or a Table Variable , however the two seem to me very similar (semantically...
asked by 26.03.2015 / 20:37
2
answers

Best high availability path for my needs

I have studied a lot about high availability in SQL Server, in its many options, that SQL Server has. But so far I have not been able to find the solution that best meets my needs. My scenery: I need to serve a chain of stores, in the case...
asked by 16.03.2015 / 14:01
1
answer

How to bring only results from the last 30 minutes

I have a table in sqlserver that will log error logs which contains the following fields: sequence \ data \ message I would like to know how to get the results of the last 30 minutes according to the current date that the example job runs:...
asked by 08.10.2014 / 15:21
1
answer

How to create a filter view?

I created the following query in my DB, I need to create a View from this query, it should return the initial 3 columns, meta, and accumulated, according to which the select is performing, however at the moment I am performing a select in the vi...
asked by 20.08.2018 / 20:40
1
answer

Error: subquery returning more than one result

Given sql: DELETE FROM wgcartarmazens WHERE ( SELECT artigo FROM wgcartarmazens as T INNER JOIN wgcartigos as A ON A.CODIGO=T.ARTIGO WHERE T.lote='' AND A.TEMLOTE<>0 ); The above query returns me the following erro...
asked by 27.02.2014 / 16:45
4
answers

Sql - Query of two maximum values

Suppose we have this database codigo, data, valor,seq (1, '2014-01-01', 10,2), (1, '2014-01-02', 20,1), (2, '2014-01-03', 30,1), (2, '2014-01-05', 40,1), (2, '2014-01-05', 50,2), (3, '2014-01-06', 60,1); I want to get the most recent date f...
asked by 25.07.2018 / 04:41
2
answers

Query on a column with different values

In my project, I have a SELECT that returns me two names, but those names are different. In my command, I need to return these two different names that are in the same column of the database in an tag of an xml I am creating. How co...
asked by 26.06.2015 / 15:13
1
answer

How to test connection to SQL Server database

I have an application that connects to SQL Server, but in a client terminal it is returning a random error. I would like to know if I can test the connection of this terminal with the SQLServer server, in isolation from my application. And if...
asked by 14.06.2018 / 15:44
3
answers

Help on select to bring field even though null

I need help to create a select, I have 4 tables (commission, person, request, request). So I need to bring all people and their goal values even though I do not have values yet in order. I made a select problem that it does not return the person...
asked by 05.06.2018 / 21:34