Most voted "sql-server" questions
SQL Server is a relational database management system from Microsoft. Use this tag for all SQL Server editions, including Compact, Express, Azure, Fasttrack and PDW.
Learn more…2,752 questions
Sort by count of
-
0
votes1
answer3728
viewsPHP Warning: PHP Startup: Unable to load Dynamic library 'pdo_sqlsrv.so' - php7.+++
Upon completion of PHP7.++ got the following error after performing all steps of SQL Server PDO Driver Configuration Tutorial for php, Restart apache2: PHP Warning: PHP Startup: Unable to load…
-
0
votes0
answers580
viewsSQL - Align Column Values to Right
Hello! I wonder if by means of an SQL sentence there is any possibility of aligning the values of the columns to the right. Here is an example below that I can do via C#, but I wanted to do the…
-
0
votes1
answer619
viewsDistribute values in column, SQL
I am extracting data from a table with the following query: SELECT [nu-cpf] as CPF, [nome segurado] as NOME, '' as IdentificacaoCliente, '' as CodigoBeneficio, CONCAT([nu-ddd],[nu-telefone])…
-
0
votes3
answers51
viewsI can’t get average
I’m unable to sum up the qtd_itens_purchase with Count cod_person. The query runs normal, frequencybuys the displayed result is the same as the amount of items that comes from "qtd_itens_purchase".…
-
0
votes1
answer49
viewsDisplay message as per condition in query
I’m making the difference between dates when the column designacao_circuito are equal and the difference (days) between the dt_hr_fecom is <= 10, I need that in the column Reinc_10_Dias write…
-
0
votes1
answer22
viewsWhere based on the value of a variable
I am working on migrating an API to a new platform and this includes migrating queries that were previously written directly into the code to functions in the database. One of the problems I’ve been…
sql-serverasked 6 years, 2 months ago Renan Lazarotto 1,025 -
0
votes0
answers851
viewsIDENTITY_INSERT is set to OFF - Entity Framework Core
I’m working on an application with Asp.net-core + Entity-framework-core and with mapping and configuration via Fluent-api. When I go into the bank I get the error that the IDENTITY_INSERT is defined…
sql-server asp.net-core fluent-api entity-framework-coreasked 6 years, 2 months ago Rafael Arthur 35 -
0
votes1
answer53
viewsError showing SQL server Sum in DAO layer
I’m struggling to show the result of SUM in the DAO layer, the query brings the expected result, however, in the field where it is to show the sum, it does not show an error. The process in Sql…
-
0
votes2
answers184
viewsHow to automatically name a manually created CONSTRAINT in Sqlserver 2016
Hello, I am creating a database and need to create some compound Index to optimize the bank processing. The problem is that I don’t want to have to name these Indexes one-on-one. Normally, I create…
-
0
votes0
answers238
viewsConnect the SQL SERVER instance
Good evening friends. I have installed in a machine SERVER a system that uses SQL SERVER, the client machine is in another city, to connect the two in the same network we made a VPN using the own…
sql-serverasked 6 years, 2 months ago c3s1 29 -
0
votes1
answer527
viewsQuery in 2 tables that have columns with the same name
Good morning, I have two tables that have the column "st", when I pull the information comes from the table st "records", I would like to pull the "st" from the table "settings". sql = "SELECT *…
-
0
votes0
answers85
viewsDoes not delete record from list and SQL database
I would like you to delete the desired record not only from the list but from the bank as well, how can I proceed? He’s going with the id "0" Instead of taking the id of the record I wish to delete.…
-
0
votes2
answers389
viewsSum the value of the column by grouping monthly and by product
Staff I need to calculate the monthly consumption of the licenses used here in the company I work. I have a table with the product (dbo. Product), the number of licenses installed on the server…
-
0
votes0
answers60
viewsCall PROC MVC to display the list of users who cannot register
Trying to call the PROC sp_UsuariosVariasTentativasCadastro_Result, that brings a list according to the form data. But nothing is happening. Someone can help me ? NOTE: I created all these "layers"…
-
0
votes1
answer37
viewsHow do I return a random value from my database already displaying in another tab?
I want to return a random value of the bank and already display in another tab, through a function. For when I click submit already calls this function. Controller public ActionResult…
-
0
votes2
answers115
viewsSelect all customers and check if you are carrier and supplier
I want to make a select that selects all customers and next create two columns a carrier call and another supplier and in each of them mark yes or no. Ex: Código Nome Fornecedor Transportadora 01…
-
0
votes1
answer982
viewsRestore a SQL SERVER database from a mdf file
I need to restore a database from an MDF file. I took the mdf from another machine to be restored on a main machine. While performing the attach, linking the MDF file, an error occurs saying that…
sql-serverasked 6 years, 1 month ago Vainer Cesario 164 -
0
votes1
answer111
viewsrelate two tables
I would like to know how to relate two tables in different databases so that every time the value in the bank table1.dbo.table id1 will be changed also in the bank.dbo.table id1, modifying according…
-
0
votes1
answer56
viewsView most current sql server 2008 record
I am trying to get the only last record (last sale) of each customer and I am not succeeding. I tried several ways, but nothing.. Only returns all sales from the date. Follow my query. I appreciate…
-
0
votes0
answers65
viewsChange the order of an XML tag via T-SQL
Hello! I’m on a demand where for a certain reason, XML was generated with the order of the exchanged tags... :( Scenario: I have a column in the SQL Server database (as of 2008) that contains NF-e…
-
0
votes1
answer108
viewsSQL - Logica de Consulta
I’m cracking my head with a situation I want to bring back a consultation considering only useful days. This table has the list of users: This table is filled by users: I want the query return me…
sql-serverasked 6 years, 1 month ago jorge rafael 13 -
0
votes1
answer45
viewsError while searching for date greater than 1 year DATADIFF() and DATAADD() function
Hello I need to perform a select in a database where the dataCompra is longer than one year. But I need to use a clause in my Where and when I try to use the function DATEDIFF() and DATEADD() so it…
-
0
votes0
answers22
viewsThe app terminates unexpectedly when I run the database
I made an application in Android Studio that inserts into the sql server database some registration data. When I give a send, the app closes unexpectedly. package imports public class…
-
0
votes1
answer422
viewsSQL Server 2017 - Recover column description/comment in table in database - Metadata
I am trying to generate a data dictionary of my database in SQL Server 2017, and would like to recover the description/comment of the 'Description' field contained in the column definitions of each…
-
0
votes1
answer111
viewsSQL Server 2017 - SELECT with Duplicate Metadata
I made a select using metadata, but the result of my selection brought me something like 'Cross Join'. Even using GROUP BY and DISTINCT returns with duplicate values. I would like an help to return…
-
0
votes1
answer254
viewsIs it possible to filter through a calculated column?
Gentlemen(s), I am performing the following select on my database. SELECT TOP 5 A.APELIDO, A.REALIZADO, A.META, CAST((A.REALIZADO/A.META)*100 AS DECIMAL(10)) AS ACUMULADO, DENSE_RANK() OVER (ORDER…
-
0
votes1
answer279
viewsHow to create a TRIGGER for an INSERT event without causing a lock in the Sqlserver table
Hello, I am doing the integration between 2 solutions, where I need to detect the change of a table, and, based on the information that is sent I must manipulate another table. I don’t have access…
-
0
votes1
answer161
viewsFilter with SQL query from a combobox - c#
I am creating a stock program and I would like the item query to be filtered by a combobox, that is, when writing in the search field only the results related to the combobox parameter appear. This…
-
0
votes2
answers876
viewsCase in Sub Select SQL SERVER
Good afternoon, I’m having trouble making a case in a subquery. I need to bring information called id_request table sf_vendas_boleto, but when it comes NULL I need to bring the id_request table…
-
0
votes2
answers160
viewsHow to get the difference in seconds with Sql Server
I know that to get the difference of seconds between Beginning and End is like this: Case 1: DECLARE @TB_DIFERENCA_INICIO_FIM as table ( ID int, DataInicio datetime, DataFim datetime ) INSERT INTO…
-
0
votes1
answer49
viewsConnect columns from different tables
SELECT e.EMPLOYEE_ID AS 'ID' ,e.FIRST_NAME + ',' + e.LAST_NAME AS 'Name' ,(SELECT DEPARTMENT_NAME FROM HR.DEPARTMENTS WHERE HR.EMPLOYEES.DEPARTMENT_ID = DEPARTMENT_ID) AS 'Department Name' ,e.SALARY…
sql-serverasked 6 years ago Bruno Bacelar 55 -
0
votes1
answer437
viewsTaking information from a JSON and saving it to SQL Server using Javascript
I have this code, which returns the information I want and shows on the page. Now I would need to save this information to an SQL Server database, as this would be possible? This is very difficult…
-
0
votes1
answer293
viewsPython Error SQLACHEMY
Is giving an error when I try to connect to SQL SERVER database with SQLALCHEMY from sqlalchemy import create_engine, engine import pandas as pd engine =…
-
0
votes0
answers589
viewsPK and FK Conflict in SQL Server Database
I am facing a Primary Key and Foreign Key conflict problem in SQL Server 2017 Express. I am using ASP.NET with Entity Framework Code First (Migrations). The problem is that when I add a new Client…
-
0
votes1
answer54
viewsWhen the property is not int how to force Entity to create a field in the table as nullable:false
Migration is generating the name field in the table as nullable:true i don’t want it to be true, as I do to solve this problem? public class Professor { public string Id { get; set; } public string…
c# sql-server entity-framework asp.net-core entity-framework-coreasked 5 years, 12 months ago Robson Junior 29 -
0
votes1
answer289
viewsLockar SELECT when I do an UPDATE - Sqlserver
Let me give you an example of what I’m doing, but the question really is at the end. I have a table with 4.100.000 records and I am creating a robot that reads this data and exports it to MYSQL (not…
-
0
votes2
answers86
viewsSave photo to database and then display it
I have an application to register students where will be inserted the photo, I want to save it and then display it, but I have a save button where I want to save all the inserted information plus…
-
0
votes1
answer170
viewsSelect <TD> javascript
I am developing a routine with a dynamic table using javascript, where when opening the routine appears a button 'ADD TABLE' When the user clicks on 'ADD TABLE' the table header appears and an 'ADD'…
-
0
votes1
answer75
viewshow do I have information passed to the textbox from id
He wanted the MRI of the student (primary key) to be filled the textbox with the information related to that student. CREATE TABLE ALUNO( RM_ALUNO INT NOT NULL, NM_ALUNO VARCHAR (40) NOT NULL,…
-
0
votes0
answers88
viewsHow do I make the infinite scroll not load the same values again?
I have the following code: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script> <script> $(document).ready(function() {…
-
0
votes2
answers448
viewsHow to return empty value?
By adding up any positive number with the result of a Subquery get as return null and need to return 0 so it is possible to add with the first value obtained. What can I do to make the query return…
sql-serverasked 5 years, 11 months ago Felipe Michael da Fonseca 813 -
0
votes1
answer127
viewsWhile always returns the last record in sql server
I have a select to bring all the records that have been entered and I need to do a while to go through this select and give an Insert in another temporary table. Only that the while is always…
-
0
votes1
answer382
viewsCalculating Larger and Smaller Than Average Returns SQL SERVER Error
In the Columns: SUM(CASE WHEN cqd.queuetime < AVG(cqd.queuetime) THEN 1 ELSE 0 END) as 'Qtde < Média' e SUM(CASE WHEN cqd.queuetime > AVG(cqd.queuetime) THEN 1 ELSE 0 END) as 'Qtde >…
-
0
votes1
answer8005
viewsHow to create a python function to connect sql server?
To summarize the connection process, I’m trying to create a function to connect the data bunch, but I’m not able to make the connection as expected: def conectar_com_banco(usuario): if usuario in…
-
0
votes0
answers82
viewsJoin in 3 tables
I need my query to return who is the direct partner of the company "Father" and the company "daughter". I already got him to return the daughter company and the direct partner, but I need him to…
-
0
votes2
answers644
viewsHow to include data from a multi-line query in a memo using Delphi?
Good afternoon. Work on a legacy system and need to put query information into a single memo object. Code follows. MyQuery.Close; with MyQuery.SQL do begin clear; add(' select TOP 8 nuentrada,…
-
0
votes2
answers537
viewsProcedure of Insert in three tables
Good morning everyone I am trying to change a precedent I created to insert a new book in three tables the table has autoencrement in the id_book column, and tables B and C are not null, I am using…
-
0
votes1
answer43
viewsHow to return what the customer bought/paid?
I have the following tables: using JOIN CREATE TABLE tbCliente ( ClienteID INT IDENTITY(1,1) PRIMARY KEY, ClienteNome VARCHAR(50), ClienteTelefone VARCHAR(15), ClienteDataCadastro DATE) CREATE TABLE…
-
0
votes0
answers92
viewsSQL Trigger Updates Stock
LISTA_DE_PRODUTOS create table LISTA_DE_PRODUTOS ( IDPRODUTO numeric identity, PRECO money null, DESIGNACAO varchar(50) null, ALCOOLICO bit null, constraint PK_LISTA_DE_PRODUTOS primary key…
-
0
votes1
answer243
viewsError executing update with sub-query
I have the following situation, I need to update several fields based on the return of a sub-query that returns a main code. This subconsultation is done with Join in two tables to obtain the code.…