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
votes0
answers21
viewsGPG error when adding SQL SERVER key
Good morning, I am installing SQL SERVER on Linux Ubuntu 18.04, as per the tutorial https://docs.microsoft.com/pt-br/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver15, but when…
-
0
votes1
answer120
viewsError connecting to SQL Server using pyodbc
I am trying to connect to SQL Server database using pyodbc lib in Python, but I am encountering error right from the start. Follow the code and error below. Script: import pyodbc conn =…
-
0
votes1
answer43
viewsDoubt about CONCAT SQL
I understand how it works about CONCAT of SQL-Server, but someone can help me? For example: I have 3 tables: Team, Engine and Pilot. used Concat with two tables Team and Motor Select Concat(Equipe,'…
-
0
votes1
answer51
viewsLEFT JOIN with more than one condition in ON - SQL Server
Hi, guys, all right? I’m putting together a query, and I need to do a Join. In this case, the AIV table records have a start date and may or may not have an end date. I want them to cross as…
-
0
votes1
answer46
viewsSQL Server - insert data after comparison of 2 tables
I have 2 tables where I want to compare the price of products: TABLE: PRODUCT produto preco A 4.5 B 6 C 10 TABLE: RANGE PRICE produto valor minimo valor maximo A 3.2 6.7 B 2.1 4.5 C null null I…
-
0
votes2
answers35
viewsSQL SERVER - Changing different records in a field based on another field
Hello, I am trying to change a column in SQL SERVER (Query) based on another column. I have divergent social reason records for the same CNPJ, so I wish that for the same CNPJ only a social reason…
-
0
votes1
answer49
viewsString Concat with Join Sqlserver
Good afternoon, I’m having a problem with creating a command line in SQL SERVER 2014 where it joins information from two tables in one row. I tried to use it that way SELECT DISTINCT SUBSTRING (…
-
0
votes2
answers108
viewsSQL query to bring the last occurrence
I have a query that performs data filtering through codes, adding the existing values, only I need to bring in the "Marked" column, only the last occurrence of a phone number, Ex: I cannot change…
-
0
votes2
answers90
viewsSQL - Integer and Decimal Number Conversion
I have a field qtfornecedor of the kind Numeric(10, 3). When its stored value is 10, he returns me in consultation as '10,000'. I tried to manipulate the value with a IIF, works for when the stored…
-
0
votes1
answer56
viewsSubstring to format date within MAX and MIN
Greetings, I have this query and need to return the maximum and minimum value of a column of a table. These values are date and are written in YYYYMMDD format, I would like to display them in…
-
0
votes1
answer39
viewsSQL VIEW Query
Good morning. I need help solving a query question in the view. I need help creating this view. Follows the table: CREATE TABLE [dbo].[Controle]( [ID] [int] IDENTITY(1,1) NOT NULL, [DataHora]…
sql-serverasked 3 years, 6 months ago Nádia Teles 91 -
0
votes1
answer28
viewsCalling the SQL variable for the program C#
I have to create a c# function that will call the variable I created in sql-server but I can’t figure out how to do it! C# code: var ss = new SqlConnection("Data…
-
0
votes1
answer73
viewsCalculate Average by SQL SERVER periods
Good night, 2 days of struggle I managed to get this result, however, I’m not able to take the daily average per month and weekly average per year. 1 Query SELECT a.Ano, a.Mês, a.Reviews FROM (…
-
0
votes1
answer59
viewsFind document that originated the following
I have a table where a document can originate new documents, and this new document loads in a column the number of the originating document (not necessarily the first document that ever existed).…
sql-serverasked 3 years, 6 months ago Rodrigo 345 -
0
votes0
answers24
viewsEntityframework Core 5 does not connect to SQL Server 2008
I installed dotnet core 5 on Ubuntu 21.04. I created a webapi project with VS Code and managed to run everything smoothly. I installed EF5 to the project and am trying to connect to SQL Server 2008…
sql-server linux ubuntu .net-core entity-framework-5asked 3 years, 5 months ago Joandreiy Cordeiro 381 -
0
votes0
answers12
viewsSQL Server error in UPDATE column with Always Encrypted
I’m implementing in a bank SQL Server the Always Encrypted which serves to encrypt columns of a table. The process of creating the certificate, link it in a table/cokuna and use it in the SQL Server…
-
0
votes1
answer44
viewsGroup by month (in each column) SQL
I am using the code below to make the column of the month of January, but I could not find a way to return the month of February to the side. SELECT CASE WHEN CODGRUPOPROD LIKE '20%' THEN 'TALHA…
-
0
votes1
answer70
viewsUpdate using different record from the same table
I need to make a update update the field record of a table, using another record of the same table and same field. My table is as follows: select produto,valor_bruto,acrescimo,valor_liquido from…
-
0
votes1
answer74
viewsSummarizing birthday girls by month (SQL)
I’m trying to count the number of birthday clients per month in my database, but I can only make it display the months that have birthday kids, for example: But I need him to show the months that…
-
0
votes0
answers35
viewsQuery of two or more mssql Pdo tables
Query of two or more mssql Pdo tables, the connection is normal. I’m having a little trouble. I have 2 tables. profile id | name | birth date | Address connections id | idperfil | data I’m trying to…
-
0
votes2
answers29
viewsRecent version of Django with SQL Server
Hello, I’m starting with a project where I will use the Django framework, and due to the nature of the project, I would like to use SQL Server (because I am more familiar), however, everything I…
-
0
votes0
answers28
viewsWrite data from two Datagridview to the Sql Server database
I’m not able to record the data that are in two dataGridView, the data that are in the two Datagridview are in a single Class, I have a code ready but would serve only for a Datagrid, in the same…
-
0
votes0
answers39
viewsDifferences of grade!
I have a situation where I need to validate the records that are in the books and the records that are in financial. I know there’s 51 bills in accounting and 52 in finance. I need to assemble the…
-
0
votes2
answers40
viewsConsultation with Count
I have the following table : Product status SELECT id_produto_status_history, status, description, create_date, id_produto FROM produto_status_history; where I store product history status There is…
-
0
votes1
answer22
viewsThe type of entity requires a primary key to be defined
I am creating a web api using the .net 5 The purpose of the application is to make a simple user registration, and in the future other types of registration I’m using an architecture DDD, and in my…
-
0
votes1
answer37
viewsHow to use SUM in a multi-return code?
I did it in a code where it makes a sum of data entered in the months, but I don’t know how to make the AS become a array. The Code I made: DECLARE @I INT = 1; WHILE @I < 12 BEGIN SELECT…
-
0
votes1
answer30
viewsHow can I solve this equation in SQL? X = (A - (B+C+D+E))
I have a table with the following columns: COD_PRODUTO|PRODUTO|UNIDADE|FAMILIA|ORIGEM|ESTOQUE_ATUAL|COMPRAS_ENTRADAS|CONSUMO_PRODUCAO|ENTRADA_PRODUCAO|ESTOQUE_MIN|CMC|DIFERENÇA|PREÇO_REPOS I need to…
-
0
votes0
answers22
viewsProblem with SQL Server connection from PHP
I was using a program on PHP that connected and read an SQL Server database. All of a sudden it stopped working presenting the following message : The client cannot establish connection because an…
-
0
votes0
answers10
viewsAt least one of the resulting expressions in a CASE specification must be an expression other than the NULL constant
INSERT INTO FILAS_CARTOES (COD_ASSOCIADO, SEQUENCIA_ADICIONAL, COD_USUARIO, DATA_REGISTRO, PROVISORIO, GERAR_SMS, STATUS, PRIORIDADE) VALUES ( @COD_ASSOCIADO , CASE @SEQUENCIA_ADICIONAL WHEN 0 THEN…
-
-1
votes1
answer101
viewsError logging in to server hosted on local IIS
When I test on my machine the login works perfectly, when I share over the network returns me the following error: A network-Related or instance-specific error occurred while establishing a…
-
-1
votes1
answer101
viewsDoubt in Procedure
Staff made a function in Sqlserver that makes the control of a chart for me in C#, this function brings me all the students of a referent school. The function is as follows: SET ANSI_NULLS ON GO SET…
-
-1
votes3
answers576
viewsDate field in Firefox and IE
I have the following code: $dataAssContrato = new DateTime($_POST['dataContrato']); This line works perfectly in Chrome, but not in firefox or IE, because when I try to register one each, I get the…
-
-1
votes1
answer121
viewsSum query
I’m having some kind of problem with this query, but what I want to happen is for all values like: Goals Scored, Assists Made,Key passes etc, to make sum for each Player ID making them appear only…
-
-1
votes2
answers207
viewsHow to create a database in SQL Server?
I installed SQL Server, and comes Magnament Studio, how do I create my bank? I tried going there, and I had authenticated by Windows but it is error. How I create my bank?
-
-1
votes1
answer360
viewsSearch by age in birth date field
Hello, I have a patient table and I need a query in which the user informs an age and returns the existing records. But I don’t have the age field in the table but date of birth.
-
-1
votes1
answer878
viewsTiered login system with access level
Good morning, I am making a software for completing a course at school, and I need to make a login system with access level (I am programming in layers and using SQL SERVER 2012). I saw a tutorial…
-
-1
votes1
answer226
viewsSQL server error: local server is inaccessible
When I try to use SQL server management studio 2008 I get this error: local server is inaccessible
sql-serverasked 9 years, 1 month ago Floyd Diestl 19 -
-1
votes1
answer3634
viewsIt is possible to disable the Primary key of a table
I was wondering if it’s possible to disable a Primary key from a table. I’ll explain why you have to disable Prime Key. I have a table B that has a foregein referring to table A, but I need to…
-
-1
votes1
answer40
viewsALTER TO - SQL SERVER
in my Bank I have 2 stored procedures ,dbo. A and dbo. B . in the database. A there are the parameters @name , @street in the process dbo. B there are the parameters @cep , @phone however I also…
-
-1
votes1
answer49
viewsQuery with sum of values in sql server 2008
I have the query below that return me the values of DESCONTO_PRECO and DESCONTO_PRECO_ESTADO, I wonder if I can add these results to come in the same field. Thanks select --calculo do desconto…
sql-serverasked 8 years, 9 months ago Harry 3,805 -
-1
votes2
answers2032
viewsHow to connect an HTML page, using ASP, to the SQL Server database?
How do I connect an sql database to an html site using Asp? Observing: I already have the entire bank developed and the full page too, I just need to know how to bridge the gap between the two…
-
-1
votes2
answers177
viewsListview in the vb6?
I started programming with this language and would like a help of how to display data that was inserted in textbox in a listview in vb6?
-
-1
votes1
answer27
viewsConfigure Firewal SQL Server
How do you configure the Firewal rule not to keep asking for an update of a new IP ? I created an account in Azure and I have a system that is in test and the server sql server from time to time I…
-
-1
votes1
answer3303
viewsSQL server 2014 installation error
Good evening guys! I am trying to install sql server 2014 express, but at the time of installation the following errors happen, what might be? Thank you LOG The error log is this. I’m sorry if you…
sql-serverasked 8 years ago Guilherme Ramos 55 -
-1
votes1
answer110
viewsQuery to join specific tables
I need to put together three different tables. But the result I want is: When there is the reference it must join, when there must be no blank or NULL. My structure: Table contact…
-
-1
votes2
answers524
viewsHow to remove the decimal separator from a result?
In the sql query I have a total order value multiplied by 1000: Total value: 195.41 Value Viewed: 195410.00 How could I remove the separator? SELECT CAST(CONVERT(varchar, CAST(195410.00 AS money),…
-
-1
votes1
answer23
viewsIs there any way to decrease or streamline this VIEW ? MSSQL, own software using ASP.NET
AS WITH Grupos AS(SELECT contato.IDContato, contato_Grupos.IDGrupo, contato_Grupos.IDContato AS IDContexto FROM contato, contato_Grupos WHERE (contato_Grupos.IDGrupo =…
-
-1
votes2
answers543
viewsAssign value to SQL variable
How do I make one select which assigns the value "10" in all of the games column? Note: Without giving update on the table. /*minha_tabela*/ codigo jogos --------------------- 1 10 2 10 3 10 4 10 5…
-
-1
votes1
answer578
viewsConnection String C# Entityframework
Would continue a project of work at home, the Connection String that works is as follows: <add name="DBModel" connectionString="data source=PD_22;initial catalog=EXERCICIO_ENTITY_JOSEEDUARDO;user…
-
-1
votes2
answers95
viewsDoubt SQL Server
Guys I’m having a really hard time with this question Can someone help me? Tables : CREATE TABLE Funcionario ( Cod_Func int Identity not null, Nome_Func varchar(100) not null, Data_CadFunc…
sql-serverasked 8 years ago dEKO 1