Questions tagged as 'sql-server'

3
answers

Inserting registry and retrieving ID generated by SQL Server 2012

I want to insert a record into a table, retrieve the ID that was generated by AUTO_INCREMENT and insert records into other tables, using that ID. But, I want to do this all using BeginTransaction . How could I do this? I'm doi...
asked by 23.11.2015 / 12:49
1
answer

Use LEAD to get the next date

I'm trying to put together a query that answers the following question: Number of customers (registration in the case) that has a 26-day reading date, number of clients that have 27-day reading, and so on up to 31 days, I will show an image e...
asked by 21.03.2018 / 06:34
0
answers

Problems with OPENROWSET in SQL Server 2016 Express (64bit)

Good morning, I'm trying to read an Excel .xls file by the OLEDB driver used in SQL Server for integrations with Microsoft.ACE.OLEDB.12.0 files in SQL Server 2016 Express (64bit). Using the command OPENROWSET but I'm getting the famous er...
asked by 02.03.2018 / 14:57
0
answers

SQLSTATE [HY000] General SQL Server error: Check messages from the SQL Server (severity 14) (SQL: select * from [product])

I have an application in laravel connecting in the database on a SQL Server when I will make a query of all the products I am getting the error SQLSTATE[HY000] General SQL Server error: Check messages from the SQL Server (severity 14) (SQL: se...
asked by 01.03.2018 / 20:55
1
answer

How to generate a counter within a select (SQL server)

I need to make a select with a case, if the condition is true I need to use a counter that will be a new column, otherwise the counter will be displayed without any changes, but I'm not able to do it, I tried the ROW_NUMBER function but it did n...
asked by 01.03.2018 / 17:51
0
answers

PHP error "Uncaught Error: Call to undefined function sqlsrv_connect ()" when connecting

Good evening, I'm developing a PHP application using SQL Server but I'm not able to connect to the database. I already downloaded the driver, I already put the dlls in the PHP ini, I already downloaded the ODBC, I already directed the folder in...
asked by 27.02.2018 / 01:45
1
answer

Select case with expression and setting the result of the else

I have a problem with a select case, I need to do a select of an expression and if this expression gives a negative result, it shows me the value, if it is positive the value has to be changed to zero, but I can not get ta giving error when chan...
asked by 26.02.2018 / 16:50
2
answers

Break lines in a list coming from the bank

I have this Dao that does a Search to the Database Sql Server public String nomeTabela() { String nomeData = ""; String nomeAlarme = ""; String nomeRecebe = ""; ConexaoDao conexao = new ConexaoDao();...
asked by 28.02.2018 / 15:54
2
answers

Search Dates with Difference Defined in SQL Server

How to perform a query on the Microsoft SQL SERVER that a days-ahead set returns only the dates that it encounters with that existing difference. for example In a table have the following dates: 02/01/2018 06/01/2018 08/01/2018 15/01/2018 2...
asked by 23.02.2018 / 04:12
0
answers

Knapsack Problem SQL SERVER CTE RECURSIVE

Good afternoon. I am trying to develop a solution within the ERP of the company where I work, in order to identify the possibilities of added FATURES whose TOTAL is equal to or approximate to a value deposited in account. If I do the select...
asked by 06.03.2018 / 17:51