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
-
1
votes1
answer882
viewsSQLSTATE[08001] - Named Pipes Provider - Laravel
I’m getting an error when connecting the application to the bank. The file . env is configured correctly with the database settings, the error I have as return: SQLSTATE[08001]: [Microsoft][ODBC…
-
1
votes1
answer189
viewsExample Query Count
Would anyone have any example of how to make a COUNT in a query, separating the data by EstadoId (as an example). In my case I have several data in my database, registered by several states, I need…
-
1
votes1
answer289
viewsDrop or Truncate table with 80 million records?
I have a table with 80 million records, clean it without deleting the table, because it is used in real time, what is the best suggestion so that I can clean this table without losing the…
-
1
votes1
answer133
viewsUse TIMESTAMPDIFF in table creation
I am adding mysql support to my program, currently only works with sql server, so I came across a problem with mysql. Table sql server: CREATE TABLE [dbo].[login_user]( [idx] [int] IDENTITY(1,1) NOT…
-
1
votes2
answers499
viewsSql server skipping record id
After changing an application record, the next record I entered in the table skipped 1000 increments in id. id’s 2 3 4 5 6 7 8 9 1015 1016
-
1
votes2
answers56
viewsQuery SQL Server - Union
Guys, the following query below through the Union is bringing in as follows. Consultor UsuID Tentativa 1 Abertos Gabriela Sousa 95093 17 Gabriela Sousa 95093 32 But I want to bring it this way:…
-
1
votes2
answers116
viewsCommand to update multiple tables in the database
It is possible to update my database as follows: My tables in the database have a field emp_codigo ? i would like to update the value of everyone that has in the database to 1 I don’t know if you…
-
1
votes2
answers1406
viewsSQL Server - Changing information in a text field (REPLACE does not work)
Hello guys. I have a table with a TEXT field. I need to change information within this text field only that I am not getting. The REPLACE function works in a varchar field, but does not work within…
-
1
votes1
answer137
viewsCombine SQL queries with different columns
I have the following queries, Q1: SELECT finempe.codigo_orgao ,finempe.cod_reduzido ,finempe.num_empenho ,finempe.data_empenho ,finempe.nome_fornecedor ,finempe.valor_empenhado…
sql-serverasked 6 years, 9 months ago V.Avancini 496 -
1
votes2
answers1075
viewsConnect SQL Server database to Django
I have an SQL Server database that already exists, and I need to connect it to my project in Django. So I come here to see if anyone has already found a solution to the problem, as they still can…
-
1
votes1
answer66
viewsPerformance of sql server with concatenated joins
Make a INNER JOIN with the keys concatenated, as below, breaks and/or impairs the performance of the bank? INNER JOIN Totvs12.dbo.SE1010 receber ON receber.E1_FILIAL + receber.E1_NUM +…
-
1
votes1
answer54
viewsHow to update a column in the auto increment database and taking into account a sort
I need to update a database table by changing a column with the auto increment value but I must take into account a sort, I managed to update with the following code with auto increment but not able…
-
1
votes2
answers119
viewsHow not to update empty fields
Would like to nay update the values sent as empty, as the second argument passed from example below, but I want to avoid using an IF, I do not know if mysql provides some function that can help me…
-
1
votes1
answer55
viewsNumber conversion
How do I convert a number float to keep the characteristics of numbers for the end user read? I am putting together a report and I wish to deal with the figures. I have a field where the value is…
-
1
votes1
answer122
viewsCan I get more than one FK referencing the same PK?
I wonder if it is possible to reference foreign keys (FK) from different tables to the same primary key (PK). Below is a piece of the SQL command CREATE TABLE Run( Project_Code INT FOREIGN KEY…
-
1
votes2
answers217
viewsUpdate item table with stock in any branch
All right Guys, I have a table with stock of products from a network of 13 stores. I want to block items that have no stock in any store and that have not had sales in the last year or that have…
-
1
votes1
answer100
viewsDoubt - Case when inside a Stuff - SQL Server 2012
Guys, how do I put a case when exists within the query below. The result is currently coming out like this: Customers Drugstore, Soccer, Gelagua However, I want to put a case when exists if it is in…
-
1
votes2
answers211
viewsSelect only tuples from a table with JOIN
I have the following query: SELECT finpag.cod_forn ,sicforn.nome ,finpag.data_pagto ,finempe.cod_reduzido ,finpag.num_empenho ,finpag.ano_empenho ,num_liquid ,ano_liquid ,valor_transacao FROM finpag…
sql-serverasked 6 years, 8 months ago V.Avancini 496 -
1
votes1
answer1350
viewsError "No column name was specified"
Could someone please let me know why you made that mistake? "Msg 8155, Level 16, State 2, Line 26 No column name was specified for column 1 of 'A'. Msg 8155, Level 16, State 2, Line 42 No column…
-
1
votes3
answers694
viewshow do I make a row_number keeping the document number with different plots?
I would like to know how to create a row_number keeping the numbers of documents equal creating the sequence by parcel. example: doc / cliente / parcela 10 15 1 10 15 2 10 15 3 23 59 1 23 59 2 23 59…
-
1
votes1
answer78
viewsQuery Doubt in SQL Server 2012
I need that in this query come only records where the ABC CURVE column is different from the MODEL column. For example, this customer the ABC curve of it is silver and the model is diamond/gold, so…
-
1
votes1
answer68
viewsIdentify source of database Locks
good morning! On my server, I own Sqlserver 2008R2 Express. I am having lock problems in the database, however, I am not able to identify which process or which application might be causing these…
-
1
votes1
answer165
viewsDelete with sub-query IN SQL
good morning friends ! I am unable to delete with Count SQL server someone could give a force? Message 116, Level 16, Status 1, Line 32 Only an expression can be specified in the selection list when…
-
1
votes3
answers250
viewsDelete repeated records in PHP
Good morning, I’m here with a very big question. I’ve been at this all day and I haven’t been able to fix it yet. I have a database in sql server and I need to present some buttons with the records…
-
1
votes1
answer362
viewsShortcut/Autocomplete in SQL Server Management Studio (SSMS)
I’m using the SQL Server Management Studio (SSMS) in version 17.5 of 2017 and would like to create some shortcuts/autocomplete to make the search process a little faster, without deploying it in any…
-
1
votes0
answers229
viewsLCK_M_IX in SQL Server database
Guys, I have two distinct client bases in SQL Server 2008, and both using the same system, which uses BDE for connection. I have my own app Scripter to make SQL queries in databases. Problem On both…
-
1
votes2
answers85
viewsInner Join - SQL Server
Guys, I need someone’s help to understand the mistake you’re making. I have two tables as the code shows, and in one of the tables the column "Code" is with information. I need to enter the codes…
-
1
votes1
answer212
viewsDatasource configuration
I am with a java application running on wildFly 8 and using Sql Server, the problem I am going through at the moment is that comes a moment the application returns me saying that I could not open…
-
1
votes1
answer1565
viewsBring the first line based on an SQL date
One more challenge stopped in my hands. I need help in my query. What I need: I want to know who are the people who have had account releases on a given day, where I need to show the value and…
-
1
votes1
answer54
viewsdoubt sql database
i want to enter record in DS_ITEM and the mistake you give me is "Cannot insert explicit value for identity column in table 'SCD_ITEM_CONTR' when IDENTITY_INSERT is set to OFF". How can I make this…
-
1
votes1
answer608
viewsCalculation between Rows and Columns Different SQL SERVER
I need a solution or function to perform the following calculation (Backlog(dia anterior) + Abertos(dia atual)) - fechados(dia atual) = backlog(dia atual) Here’s a screenshot of the table below.…
-
1
votes1
answer92
viewsHow to assign a database value to a new object in C#?
I’m creating an app like a bench to train C, but I ran into a situation. I have a database with the tables Accounts, Clients and Tiposconta. In the table Tiposconta there are registered the item…
-
1
votes1
answer174
viewsIs it possible to identify the source database of a stored SQL database?
I have a stored-Procedure in SQL 'spr_insere_carga_requested' where when executing the sp_helptext command in a given database it was not identified; there is some way to identify the database where…
-
1
votes1
answer44
viewsDoubt in Select
I have mysql database with some registered information and I need to search through a select Championship and Modalities that a person has no link, but I have tried several ways and I could not…
-
1
votes2
answers121
viewsHow to format decimal numbers using Fluent API in the Entity Framework?
How to create a formatting with precision 10,4 (4 decimal places) to save decimal data to SQL Server? This format description goes inside the modelBuilder, however, I have not found any code already…
-
1
votes1
answer149
viewsSQL Server Data Types
I have a question about the type of data real in SQL Server. I’m trying to store the value of 1.5 in a real type but it represents 1.5 as 1.5, wanted to know if when I was passing this value to a…
-
1
votes1
answer272
viewsConnect Sql Server 2014 to Django 2.2
I am trying to connect the Sql Server database to Django but am getting the following error(The connector I am using is Django-pyodbc-Azure): Django.db.utils.Interfaceerror: ('IM002', '[IM002]…
-
1
votes0
answers38
viewsAzure and SQL Server MV Configuration
I need to develop a system for a medical clinic and this system will be accessed by 2 Receptionist and 2 Doctors. Initially the System is not complex but tends to grow as the Clinic will hire more…
-
1
votes1
answer132
viewsMerge two IF or more
I need to unite some if's and I’m having difficulties, I’ve tried using with the union, but to no avail. The query I’m running is: IF (select count(Estado) FROM tbl_1 where Estado != 'WIP' AND…
-
1
votes1
answer46
viewsPK error during Asynchronous process of process
People I came across a situation where I was able to solve the problem but I would like to know more in depth how the UPDLOCK works. I had a situation that was basically like this inside a trial:…
-
1
votes1
answer116
viewsHow to total the number of records per Category using a VIEW SQL SERVER
Good night. I’m not finding a way to, using or just calling a VIEW, count how many teachers there are in a certain category, whose output should be the category and the amount. The VIEW I made is as…
-
1
votes2
answers421
viewsMy C# software with SQLEXPRESS Localdb database does not open on another PC, even installing all dependencies
1 - My C# software with SQLEXPRESS Localdb database does not open on another PC, even installing all dependencies. NOTE: My Development PC works perfectly. 2 - Programs I have already installed in…
c# sql-server sql-server-2014 sql-server-express sql-server-localdbasked 6 years, 7 months ago Dener Portela 9 -
1
votes1
answer1719
viewsHow to sort varchar field with letters and numbers in sql server
I have the following query below and would like to sort according to the image, however the numbers. WITH cteNiveis(IdConta, NivelRec, NomeTab, Caminho, Nivel, Tipo, Status, Nome) AS ( SELECT CO.Id,…
-
1
votes0
answers166
viewsStoredprocedure in SQL-Server passing a C#List parameter
I would like to pass a list of parameters to a precedent, how to do this process? I did some research and I thought it is possible to create a TABLE TYPE and use it in the parameters of the past,…
-
1
votes2
answers476
viewsSave/Recover Files with PDF Extension
To save files with extension PDF in the database it is necessary to do the conversion to base 64? Or would there be some other way to save this type and its recovery for viewing? The code I have…
-
1
votes2
answers69
viewsHelp with handling employees' schedules
I have a situation regarding company employees' lunch check-in and check-out times; I need to limit the number of employees who can have lunch at the same time, at least together in the 15-minute…
-
1
votes1
answer79
viewsSQL Procedure improvement
I wonder if there was a way to improve a code I made on hand in SQL... I have a table from the following table Chave identificadora - DataProduto - Preço - Marca Lanche - Pao/presunto - 01/01/2017 -…
sql-serverasked 6 years, 6 months ago Voltz 351 -
1
votes0
answers84
viewsHow to update a sequence to be changed?
Good morning! I have a bit of a boring situation here at work... I would like an idea to solve this problem. There is a case that often happens that is basically the following, When a given customer…
-
1
votes2
answers128
viewsHow to separate records into blocks for parallel processing?
I have a table in SQL Server that makes the control of messages to be sent and a routine in C#, configured in a Cron, which selects pending messages, sends and marks as sent. What I’m implementing…
-
1
votes1
answer57
viewsIs it possible to know which program ran some SQL command and the table related to the command?
How to make a query that returns the history of the executed command type (UPDATE, INSERT, DELETE), the date, the name of the program you executed (Program_name), and the table that has been…
sql-serverasked 4 years, 3 months ago hikoruKazuto 43