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
answers48
viewsDynamic search like php and SQL Server does not bring results?
I’m having trouble with one part of the code... I have 5 fields to be searched with input, and they make a call in the database and complete with the respective data... But among these 5 fields , 2…
-
0
votes0
answers153
viewsException when accessing web service in Xamarin.Forms application
I’m creating an application with Xamarin with Visual Studio 2017. I did all the tests on the web service and it accesses the database and records everything perfectly in the browser version. I have…
-
0
votes2
answers75
viewsFilter data table
How to select only part of a table record? Source data: "brt_qsr01:NT" and I intended it to return only qsr01 I’m doing so, but then I can’t remove the data on the left SELECT left([coluna],…
sql-serverasked 6 years, 9 months ago lcoelho 1 -
0
votes1
answer291
viewsConnectionstring returning null
When trying to run my project is returned me the error: System.Nullreferenceexception: 'Object reference not set to an instance of an object.' I have a bank class with the manufacturer: public bd()…
-
0
votes1
answer113
viewsSPLIT_STRING in several 'paragraphs'
I’m trying to take this kind of table: In which I have a daily import for a dbo, I now have difficulty split_string the comments, cross with the ID. The idea is to have as many lines as (additional…
-
0
votes1
answer316
viewsINSERT with database information inside another C#database
I am trying to make an application where I can back up several banks at the same time by placing the information of the banks (which will be backed up) inside a bank that will allocate this…
-
0
votes2
answers150
viewsInner Join Database
Staff I am using this command on sqlserver: SELECT ALUNOS.NOME, DISCIPLINAS.NOME AS DISCIPLINA, MAX(NOTAS.NOTA) AS MEDIA FROM NOTAS INNER JOIN ALUNO_DISCIPLINA ON ALUNO_DISCIPLINA.identificacao =…
-
0
votes1
answer335
viewsINSER lock trigger with condition and error message
I would like to create a Trigger on a condition that only does not generate payment launches for a system-specific financial responsibility code and that the others let it pass and when it did not…
sql-serverasked 6 years, 9 months ago Charles 3 -
0
votes0
answers37
viewsOFFSET does not work on SQL Server
I developed the sql side paging in my SQL Server 2014, when I played in production gave the problem with the OFFSET because the server has sql 2008. I tried to implement otherwise but did not…
-
0
votes0
answers129
viewsHow to Model Tables to Store Tag
I have an SQL Server database where I have a table of videos linked to various tag s. How is done here in the forum where each post is linked to various tags. Best practice for modeling the…
-
0
votes1
answer69
viewsSQL Server Code for Question
After 1 hour back of this question I cannot solve the code for it. Can anyone help me? Question: "Indicate the number of drivers per brand of car" The SQL Server tables created were the following:…
-
0
votes1
answer23
viewsHelp with job creation agenda query
Galley, I’m making a script to trigger a message according to the record recorded in the database. It’s like a CRON task. I have the following record I will put a PHP page in the CRON task of…
-
0
votes1
answer264
viewsDelete older duplicate data on MS SQL server
I’m having a problem with a table that has duplicate data. Duplicate data is identified through an ID, where each row has the identifier and a date, how can I erase all data with more than 1 record…
-
0
votes2
answers2099
viewsHow to export an SQL table to a . txt file?
good morning! I need to insert the return data of a Select into a file . txt containing the column names and separating the data by ";" How can I do this process? Grateful From Now…
-
0
votes1
answer98
viewsQuestion for SQL Server - Code
What are the names of the pilots who did less than '1:12' in the 1st round of the 2nd race? How can I make the times of every turn? I’ll have to make a new table? The SQL Server tables created were…
-
0
votes1
answer37
viewsSqlserver // Tables
I created a Database and it contains two tables, I put the script: Table Client Create table Cliente( Cod_Cliente int Primary key NOME Varchar(50) SOBRENOME Varchar (50) ) GO Table Size of the…
sql-serverasked 6 years, 8 months ago Eric Rosário 90 -
0
votes1
answer234
viewsError running SQL "Create Trigger..." inside a C#application
Goal: Run a create Trigger script using a string within C#. Problem1: Table not found (because the script does not indicate in which Table to create Trigger). Tentative2: Start string with "Create…
-
0
votes0
answers338
viewsJoin querys using Outer apply
I have these three querys, and I want to put them together using the outer apply. How can I do that? SELECT SR1.COMPANY, SR1.FILIAL, SR1.DOC, SR1.SERIE, SR1.LOCAL, SR1.TIPONF, SR1.CLIFOR,…
-
0
votes0
answers27
viewsHRESULT:0x80020003 error in sql server
I am working with a Sql server database and it started to present a strange error, preventing me from accessing the design and creating new Tables. I looked on the Internet and I couldn’t fix that…
-
0
votes2
answers220
viewsSearch Dates with Difference Defined in SQL Server
How to perform a query in MICROSOFT SQL SERVER that before a defined number of days returns only the dates that meet this existing difference. for example In a table have the following registered…
-
0
votes1
answer201
viewsSelect case with expression and setting the Else result
Personal someone can help me with a select case problem, I need to make a select of an expression and if that expression gives a negative result, it shows me the value, if positive the value has to…
-
0
votes3
answers1947
viewsAdd time column in SQL SERVER
I got a column like team in a table. With records such as: 00:02:15 00:09:47 00:00:25 ... I need in mine select, find the sum of those minutes in format team. Return example: 00:12:27 I tried in…
-
0
votes3
answers378
viewsDoubt SQL query d
I am wanting to perform the calculation in sql query where the result is the number of open calls divided by the number of working days chosen period. Ex: They were opened 200 calls in the month and…
-
0
votes1
answer833
viewsHelp with Trigger summing/subtracting
I need help creating a Trigger in SQL Server that takes a value INTEIRO, and two STRING(FK), inserted in a tabela X, and check if the second value is 1 or 2, if it’s 1 she must add up this value…
-
0
votes1
answer3477
viewsError: Error Converting data type nvarchar to Numeric
I am trying to convert data from a column in NVARCHAR(255) to DECIMAL(10,2), however, all the ways I tried always gives the same error Error Converting data type nvarchar to Numeric. I created…
sql-serverasked 6 years, 7 months ago Kelly Soares 1,181 -
0
votes1
answer878
viewsPassing an Array of Strings to a preparedStatement?
I am trying to pass an array of Strings to a preparedStatement, but it’s returning this exception: java.sql.SQLFeatureNotSupportedException: This operation is not supported. at…
-
0
votes1
answer1114
viewsHow to decrypt records from an SQL column - Query
Good morning! Guys, how to decrypt records from a column in an SQL query. The field I want to decrypt is the coluna MAX(A.Descricao) [Descrição da Última Providência]. SELECT…
-
0
votes1
answer7723
viewsRemove "." /" and "-" from varchar in select
I’m performing a query for a client where it requested that the CNPJ/CPF of companies/customers be displayed without the dots, bars and dashes. For example the CNPJ 08.595.551/0001-57 should be…
-
0
votes2
answers1605
viewsCalculate column date - 6 months of current date (SQL SERVER)
I have a column in db that is D_EMISSAO and in it has a date yyyyddmm. I have to show the data that are related to column D_EMISSAO if it does not exceed 6 months according to the date D_EMISSAO…
-
0
votes1
answer95
viewsSQL SERVER Counting Items from a Calculated Field
Good afternoon, I’m having a hard time doing an item count on SQL SERVER, I need to count a column that MYSELF CREATED, where there is a rule, and there are several errors in my tests, errors in…
-
0
votes2
answers7693
viewsForeach in SQL to put a value in a variable
My problem is that I have a subquery that works perfectly, but for that I have to insert the id I want in the variables. In the variable @mediaKM_mes I select to the table tblAbastecimento by the…
-
0
votes0
answers969
viewsDecrypt Procedures and Functions in SQL Server
I need to decrypt some routines they’re using "WITH ENCRYPTION" and would like to know if there is any way by SQL Server itself, without needing to use third party tools, to do this.…
sql-serverasked 6 years, 6 months ago Ricardo Souza 459 -
0
votes1
answer303
viewsdatetime vs dateime2, which is the best?
I’m implementing a new project, using EF6 Codefirst, EF6 creates my database Sql-Server, with date columns as type datetime. What would be the difference between datetime and datetime2, and which is…
-
0
votes1
answer295
viewsSelect to pick up 2-column Constraint
I have a PERSON table in it that has the field A and B that form a UNIQUE. I rotate this select to return the name of the constraint: SELECT DISTINCT COL.CONSTRAINT_NAME FROM…
-
0
votes1
answer3060
viewsError - Query: The sub-query returned more than 1 value
I am new to SQL and I have the following error in my query: "The sub-query returned more than 1 value. This is not allowed when the subconsulta follows a =, != , <, <= , >, >= or when it…
-
0
votes0
answers25
viewsDecrypt password field of an ASP application that saves to an MSSQL BD
I need help to figure out how to decrypt or just read this password from my database, it turns out I need to use this user table for another application, however I have no idea what kind of…
-
0
votes1
answer3833
viewsConsuming webservice by SQL Server?
I am using sql server 2016 to consume webservice by Procedure store. I have a JSON webservice returning the following:…
-
0
votes0
answers116
viewsSQL needs CAST to return values in query
Gentlemen I manage an application PHP which uses SQL Server 2008 database. After a server migration from the database queries only work by converting with CAST and selecting one by one on SELECT.…
-
0
votes1
answer60
viewsNot bringing the records - Query SQL
Good afternoon! Guys, below is the query that is to bring the amount of active clients in one column and the amount of locked clients in another column, however, when running the query, comes null…
-
0
votes0
answers37
viewsShopping cart error in array when recovering last id sqlsrv_fetch_array 11- is not a Valid ss_sqlsrv_stmt Resource in
I am mounting a shopping cart but am facing the following error I mentioned in the title. The method takes 2 parameter the $listProducts is an array as all purchase information and the $Total…
-
0
votes0
answers266
viewsSQL Server Connection
I’m trying to make direct connection to SQL Server, for testing, but at the time of testing "Register" by clicking the button, the app simply hangs, there’s something wrong in the code? package…
-
0
votes1
answer2232
viewsHow to calculate average and show the highest and lowest values?
I started to study SQL SERVER and face the following problem: create a function that calculates the average of the students and if it is GREATER THAN 7 the student should be considered approved; if…
sql-serverasked 6 years, 6 months ago Luzinete Maciel 13 -
0
votes2
answers1867
viewsView with double SELECT from the same table
I need to build a VIEW with three fields, but one depends on the other to be calculated (two of them are from the same table on different lines need "link them"), how do I aggregate these fields in…
-
0
votes2
answers477
viewsCondition in Trigger
About the following Rigger: CREATE TRIGGER [dbo].[TG_TESTE] ON [MINHABASE].[dbo].[TB_DOCUMENTOS] AFTER UPDATE AS DECLARE @ID INT DECLARE @DOC INT DECLARE @QTD FLOAT SELECT TOP 1 @ID = ID, @DOC =…
-
0
votes0
answers184
viewsChange field format in excel to import into sql server Wizard
I need to import data from an excel to sql server. My big problem is that the data coming from the source, from an excel column is being interpreted by this Wizard as varchar, even though I make all…
-
0
votes1
answer673
viewsSQL to count records that have a field
Good afternoon, I don’t know how the rules of the topic work, I asked for help on a previous topic and one of the members ended up helping me only that I wanted to ask another question about the…
-
0
votes1
answer231
viewsSQL Server - count records by combination
I am needing to make a query in sql server so that it identifies to me when combinations 1,2 and 3 or 2 and 3 of the "desc" column are present for repeated values of the "Cod" column the result…
sql-serverasked 6 years, 6 months ago aguch 39 -
0
votes2
answers762
viewsHow to put ISNULL in Subselect with case?
How do I return instead Null return as Não. I’m having second thoughts about using the ISNULL within the Subselect along with the case. Upshot: Projeto teste Null Projeto OK Sim. Instead of Null I…
-
0
votes1
answer958
viewsSum with Negative and Positive Numbers - Sql Server
I am trying to sum up positive and negative values in the Sqlserver database, but the same done by the calculator returns a different value. I’m using SUM(NR_QUANTIDADE) The NR_QUANTIDADE column is…
-
0
votes1
answer644
viewsC#, Returning an Sql Server query in Data Grid View
I have a bizarre problem, I have a table in the database Sql Server, where there is a field bit, I’m pulling data from this table, which is actually a View. I do my instruction Select, and executed…