Questions tagged as 'sql-server'

4
answers

Add and subtract value from the same SQL column

I have a table with the following data: +---------------------------+ | Cod_Art | Armazem | Quant | +---------------------------+ | 11430001 | 1 | 0 | | 11430001 | 2 | 3 | | 11430001 | 3 | 0 | | 11430001 | 4 |...
asked by 12.01.2016 / 19:20
1
answer

Pivot dynamic columns

I need to display this: So: Following the link's instructions: Using the PIVOT operator without aggregation I can not place a subquery inside the IN in PIVOT Dynamic Pivot with SQL Server I came to this script: create t...
asked by 16.12.2014 / 20:00
3
answers

How to do update with count in SQL Server?

I have the following table: Nome | Posicao Item1 | NULL Item2 | NULL Item3 | NULL I would like it to look like this: Nome | Posicao Item1 | 1 Item2 | 2 Item3 | 3 Sorting criteria is Name     
asked by 03.09.2015 / 21:11
1
answer

How can I get a date 60 months ago?

I want to pick up some date 60 months ago. I'm in a project that shows only files Sent to 60 months, but 60 months rather than 5 years, may not make any difference. Any ideas? I tried to use datediff, but I'm not successful. I want to do t...
asked by 10.09.2014 / 12:43
4
answers

Change registration day only

Scenario (example): I have the following table: ID | TIPO | DATAINCLUSAO 1 | 10 | 21/07/2018 09:34:51 2 | 10 | 11/07/2018 11:15:25 3 | 11 | 23/07/2018 01:52:31 4 | 11 | 04/07/2018 23:24:52 5 | 12 | 25/07/2018 03:43:33...
asked by 15.08.2018 / 14:23
2
answers

Error connecting to sql server database with java and problem with connection string

I put the jar and did the build path. I've been trying for some time to connect to the microsoft bank but it gives this error: Exception in thread "main" java.lang.RuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: Falha na...
asked by 25.02.2016 / 04:58
2
answers

Set default SQL Server column value

I would like to know how to set an insert pattern in a column in SQL. Example: CREATE TABLE XPTO( ID INT IDENTITY(1,1), NOME VARCHAR(100) NOT NULL, ATIVO CHAR(1) NOT NULL) In this case, I want to limit the ACTIVE fie...
asked by 15.03.2017 / 17:14
2
answers

Protect SQL Server database

I have 2 SQL Server databases in my SQL Server Management Studio. I would like to put a password in one of them, making it impossible to access it, is it possible?     
asked by 04.05.2017 / 21:26
2
answers

Application Server

The client does not have a server (Windows Server or Linux) and does not want to host the system in a data center or in clouds for example, and wants to use the system on an intranet. At the moment 3 employees will use the system being deve...
asked by 29.09.2016 / 13:20
2
answers

SQL query taking too long and returning a Time Out error

I am trying to perform a query in SQL. Here is the method: public void excluirVenda(int Codigo) { Conexao conexao = new Conexao(); SqlCommand cmd = conexao.CreateCommand(); SqlTransaction transaction = null;...
asked by 05.10.2018 / 15:03