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
-
-2
votes2
answers184
viewsCan anyone explain this mistake to me?
I have 2 tables, products and suppliers. And is appearing the following message: System.Data.Sqlclient.Sqlexception: 'The INSERT statement conflicted with the FOREIGN KEY Constraint…
-
-2
votes1
answer56
viewsReordering Autoincrement in SQL
Eae guys, like I created an ID table with Auto Increment, checking the table ví Bugou, have any SQL commands that reorder from 1,2,3,4 to last? just more for the sake of reorganization. Thank you.…
-
-2
votes1
answer59
viewsSQL Sorting and Grouping
How could I sort this table by placing it in order of the Field name column not being in alphabetical order and following the Right to Right field. For example, each field name has several different…
-
-2
votes1
answer251
viewsANSI text for utf-8
I wanted to know if it has how to convert text that were utf-8 and was placed in ANSI, with that it gave error and in place of accents, are other letters totally messed and codes I wonder if you…
sql-serverasked 5 years, 6 months ago Rafael Marega 1 -
-2
votes1
answer1079
viewsselect max(id) of each* record
opa personal, I have a query with this data of the image, I wanted to give a select only in max(id) of each numberExterno to save in another table@…
-
-2
votes2
answers35
viewsHow to not show junk value when pulling a data from a null PHP database
I’m pulling a value VARCHAR from the bank , I convert it to appear in DATA format , as long as the value is white in my bank, it pulls me a number "31/12/1969" . How can I fix this ? How I’m turning…
-
-2
votes1
answer70
viewsNo repetition of SQL SERVER code
I have the following code in sql server. I need to make sure that in the first if it comes out and runs the same instruction that is inside the Else tag not to repeat the code that is inside. How do…
-
-2
votes1
answer27
viewsHow to insert a value in a table copy?
I’m performing a table transfer "Histo_Ficha_Controle" for "Cad_Espec_Teste". The two tables contain the same fields to receive the information. When copying from one table to another, I would like…
-
-2
votes1
answer42
viewsHow to copy data from one column to another column of the same table
Hello, good afternoon. I have a column table called City where inside it has 5 fields(Codecompleto(PK), Code, Name, State, Nameclear). This Nameclear was created to receive the Name without accents.…
-
-2
votes1
answer120
viewsSubconsulta returns more than one value
Good night! I have an sql query based on a CTE and I want to take the largest value between a subconsulta, but when I run the main query the subconsulta error returns more than one value appears.…
-
-2
votes2
answers116
viewsProblem to send values of type 11.50 to SQL Server database
I have a problem formatting values type R$ when sending to the data bank 11.50 in the data bank is type 1150. This condition is from the send button to the database has a database management class…
-
-2
votes1
answer24
viewsSQL Server How to link the name of a column to an external variable?
Good morning Srs I made an SQL code that separates an item from each record from a column without repeating, and is working correctly, follows code below: SELECT Tab_Dados_Escolha.Nome_Produto FROM…
-
-2
votes1
answer32
viewsPass database and table as parameters to process
I need to make a Stored Procedure of the following kind: USE master GO CREATE PROCEDURE dbo.sp_DR @bd NVARCHAR(20), @VAL AS INT AS SELECT * INTO #TEMP FROM @bd where campo =@val SELECT campo1,…
-
-2
votes0
answers28
viewsDifference in Sql Server value To C#
Guys I’m converting this formula here to a C code#: declare @decPorcDescuentoTotal DECIMAL(18, 5), @decImporteCuota DECIMAL(18, 5), @decImporteSA DECIMAL(18, 5), @intCantCuotas INT set…
-
-2
votes1
answer42
viewsDelete api not working, do not delete. Stored Procedure in the database is working
This is the API public class DeleteCidade { BancoContext banco = new BancoContext(); public void deleteCidade(int id) { banco.Database.SqlQuery<Cidade>("exec sp_del_cidade", new…
-
-2
votes1
answer65
views0097 - missing parentheses on the right. - Can help
I know you already have some negotiations here in the forum about this error 0097 - missing parentheses to the right.. This is my command, you can help me ? select distinct Coalesce(Sum(Case When…
-
-2
votes1
answer1010
viewsNODE.js Insert in MS SQL
I am trying to run an INSERT in my MSSQL through my NODE.js server But it’s not working. I believe it is not a connection problem because (as I will demonstrate at the end of the post) I made a…
-
-2
votes1
answer2682
viewsIncorrect syntax near ','
The code is this: <i> <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#include virtual="aplicativos/arquivos.asp"--> <!--#include virtual="aplicativos/JSON_UTIL_0.1.1.asp" -->…
-
-2
votes1
answer1003
viewsSQL - Show the top 10 values per month
I would like to show on the screen the 10 highest donation values of each month of the year 2018 table Doacao. My database is SQL SERVER. For now I have the following query: select…
sql-serverasked 5 years, 10 months ago c3s1 29 -
-2
votes2
answers65
viewsI’m trying to do a research boot on my view, but tell me it can’t be null
I’m trying to make a search button on mine view of films, but gives me a mistake to say that I can’t have a zero value. Why? And what do I have to do? Controller: public ActionResult Index(string…
-
-2
votes2
answers412
viewsHow to use BETWEEN and LIKE together in a Query?
Well I have a table that contains some tables being them ( DATA_INICIAL , DATA_FINAL ) however I’m trying to generate a report that contains the data between the initial and final dates , and who…
-
-2
votes1
answer45
viewsQUERY SQL SERVER QUERY
I have a question how to proceed in this case, where I have a query that would need the nserie was ignored or showed only the 1 item of that SELECT ped.codfil, i.seqipd, i.codpro, p.codref,…
-
-2
votes1
answer108
viewsProblem with result Undefined - nodejs
I am having problem to recover the data from db SQL Server with Node the same does not pull in any way the result of the query informed: module mssql dbConnectio const sql = require('mssql'); const…
-
-2
votes1
answer900
viewsError: No support for keyword: 'Provider'
I have to maintain a system and it is with a problem that I can not solve for 1 month because of a connection failure. There is no support for the keyword: 'Provider'. Description: An untreated…
-
-2
votes1
answer658
viewsSQL Server does not connect to SQL Management Studio
Guys, I’m just coming here because I’ve tried everything, all the steps on the Microsoft site for this kind of problem I’ve tried, downloaded SQL Server 2017 and later downloaded Microsoft SQL…
-
-2
votes1
answer206
viewsInitialize a Node.js server and connect to MS SQL
I’m starting to use Node.js and developing web applications, I believe this is a very basic doubt, but I found nowhere a solution to my problem. I need to connect my . js with MS SQL, found the…
-
-2
votes1
answer39
viewsOrder By Doubt with LINQ to generate report
I’m making a report with the iTextSharp and I order by date but when I view the report the company Empresa2XYZ appears 2 times with the same date. Follow the code with LINQ. lista =…
-
-2
votes1
answer38
viewsInner Join with 3 different tables and Joins
Greetings, I need to make a query in the database that takes into account 3 tables. We use a proprietary application that has no automatic update, so I need to monitor who is not with the latest…
-
-2
votes1
answer1670
viewsINSERT conflicted with FOREIGN KEY constraint
I have a problem when performing INSERT in a table in my BD because whenever I try to perform INSERT SQL Server return me this : The INSERT statement conflicted with the FOREIGN KEY constraint…
-
-2
votes1
answer122
viewsQuery error Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, Boolean Given in
I created a project in XAMPP where it is working perfectly. But when hosting on 000webhost, it emits this error. Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given…
-
-2
votes1
answer40
viewsSQL Server Query
can help me with this consultation? CREATE TABLE Region ( idRegion INT PRIMARY KEY IDENTITY(1,1) ,cdRegion VARCHAR(50) ) CREATE TABLE Store( idStore INT PRIMARY KEY IDENTITY(1,1) ,cdStore…
-
-2
votes1
answer56
viewsCASE RETURNING MORE THAN ONE LINE IN A SUBCONSULTA
I’m having a problem in a sub-sale that returns me the payment type (CREDIT OR DEBIT) and whether the payment was in card or not. However, if I have a payment with the two types of card the…
-
-2
votes1
answer42
viewsTrying a CRUD with Asp.Net Core 3.1 and gives error in connection with Sql Server
This is my connection string "ConnectionStrings": { "bdcoreconn": "Server=.\\SQLEXPRESS;Database=BdCoreCrud;Trusted_Connection=False;MultipleActiveResultSets=true;User Id=sa;Password=Simb@d123;" },…
-
-2
votes1
answer129
viewsQueries Mysql database
Currently I have studied SQL Server and My SQL in college, but having a lot of difficulty in making queries in the database. The bank has 3 tebelas (aluno, discuplina and matricula) Show the total…
-
-3
votes2
answers2058
viewsError connecting JDBC to local sql Server
I try to connect java with Sql Server from my local machine but I get this error com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1434 has failed.…
-
-3
votes2
answers712
viewsSelect separated by semicolon to xls
I have the following code: var cmd = @"SELECT mt.Id + ';' + mt.Nome + ';' + mt.Cidade AS Resultado FROM MinhaTable mt"; var objectContext = ((IObjectContextAdapter)db).ObjectContext; var result =…
-
-3
votes2
answers500
viewsHow can I make a C# query in a SQL Server database
I have a project in development in this internship path and therefore I am working on new things. I would like to know how to do in C# a query of data present in SQL Server tables. Sorry if you are…
-
-3
votes1
answer782
viewsRead and insert data into a table via C#
I have this code to insert values in a table column: conn.Open(); comm.CommandText = @"INSERT INTO ArticleBarCode(Code, Code_Article, BarCode, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn,…
-
-3
votes1
answer110
viewsCan someone help me find the mistake in this create?
CREATE TABLE PedidoProduto + ProdutoPedido ( Quantidade numeric(50), IDproduto int, IDpedido int, FOREIGN KEY(IDproduto) REFERENCES Produto (IDproduto), FOREIGN KEY(IDpedido) REFERENCES Pedido…
-
-3
votes1
answer43
viewsReturn dates between number of days
I wonder how I do: I want a variable like days then take the result of this variable and select between the dates counting the number of days Some solution or example?
-
-3
votes1
answer51
viewsAverage
Good Afternoon! I need to calculate the average of this calculated column. SELECT RESUMO.CODCOLIGADA, RESUMO.ID_CCUSTO, RESUMO.CODCCUSTO, RESUMO.NOME, RESUMO.DTBAIXA, SUM (RECEITAS) AS RECEITAS,…
-
-3
votes1
answer21
viewsSql server heritage in Procedure
I’m having performance problems using views mapped in the EPH to use linq for grouping and paging. It would have a way to assemble a procedure basis, where I explained what it would take for all the…
-
-3
votes1
answer1782
viewsSum of SQL accumulated value
I have a stock value and need to display the information of the stock movement based on invoice. Table Drive Cod | Tipo | NumeroNota | Quantidade | DataEmissao | Material 1 | S | 12312 | 1 |…
sql-serverasked 5 years, 6 months ago EmanuelF 408 -
-3
votes1
answer57
viewsDATE CRITERIA ENTER A SUBQUERY - SQL
I am doing a query that the boundary dates are based on subquerys, I would like to put a condition so that the boundary column is between data1 and data2 follows the query: SELECT PSECAO.CODIGO…
-
-3
votes2
answers58
viewsData conversion in SQL server after using in Where clause?
I need to extract sales from such a date period until such date. For example, between 01/04/2011 and 30/04/2011. I am not able to bring the result of the period in question. In this case, I am using…
-
-3
votes1
answer31
viewssending email with phpmailer
Hello. I have a query (SQLSRV) that brings me a list of clients with expired financial securities. I have to send an e-mail (PHPMAILER) to each one with their outstanding expired securities. As I am…
-
-4
votes2
answers1849
viewsAdd a line at the end of the query in MS-SQL
I have a query and it returns the following table: I wonder if it is possible to add one more line (in this case to 3) to make the difference between the two years. I wanted a new line that would…
-
-4
votes4
answers620
viewsHow to round off this number: 3084.08 SQL SERVER?
How can I round this number: 3084.08 to: 3084.09 in sql server?
-
-4
votes1
answer604
viewsSQL recursive using CTE
I am mounting an SQL statement using CTE (common table expression) and recursiveness, but I’m getting the following error: Message 530, Level 16, Status 1, Line 5 Instruction terminated. A maximum…
-
-4
votes0
answers52
viewsHow to insert multiple rows into a sql server, keeping all these rows in the same id
I am studying a program that lends equipment, in its proper functioning, when making a loan of material should be kept in the dbo.emprestimo all loan details (name, location, business, etc), then…