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
answer425
viewsIs there a difference in performance between INNER JOIN and CROSS APPLY?
I am starting studies on SQL SERVER and some places teach to use the INNER JOIN to make the junction of two tables. However, there are some other places that teach via CROSS APPLY.…
-
0
votes1
answer175
viewsIs there a command in sql server that returns the number of records in a table?
I have a table called client with several customers already registered and I want to filter all customers who are the same age and get an entire number of these records, in case the amount of…
-
0
votes3
answers2912
viewsCreate Trigger with update setando field through a function
I’m looking to use a trigger to update the field of a table whenever there is an Insert in this same table. The problem I’m having at Trigger is that the update doesn’t work, it follows Trigger:…
-
0
votes1
answer681
viewsHow to fill a Dropdownliste with ASP MVC
Good afternoon, as I can fill a dropdown with data from a database using pure Ado.net (code) and without using Entity framework? I have two tables in my bank that relate. First I must register a…
-
0
votes1
answer51
viewsHow do I bring the same numbers from other tables?
Good morning, I’d like that help. I have a table of "INSCRIPTION" where it has 2 foreign keys (CAND_SQ and CANDPL_SQ). Both foreign keys have a CPF field. I would like to know how I bring the…
-
0
votes1
answer930
viewsSystem.Nullreferenceexception: 'Undefined object reference for an instance of an object
I was trying to run my database but this error appears. System.Nullreferenceexception: 'Undefined object reference for an instance of an object. con era null using System; using…
-
0
votes3
answers59
viewsSave BD register
Hello, I am having a write problem in Sql Server, I have two tables(post and user), when I try to save the C#record, the error appears: (System.Nullreferenceexception: 'Object Reference not set to…
-
0
votes0
answers46
viewsUPDATE between 2 SQL tables giving error
I am trying to perform an UPDATE and it brings me the following error: "Message 157, Level 15, Status 1, Line 40 - An Aggregate may not appear in the set list of an UPDATE statement." Follow the…
-
0
votes0
answers30
viewsProblem with stored Procedure
I am trying to create a stored precedent that checks whether the table is empty or not, if it is empty returns -1, if it is not empty return the most recent element of the table. I’m trying this way…
-
0
votes3
answers182
viewsError submitting form with ASP MVC
I am facing a problem submitting a form developed in ASP MVC. By clicking the save button the following error message is returned: System.InvalidOperationException: 'Não existe item ViewData do tipo…
-
0
votes0
answers42
viewsJOIN WITH 3 TABLES
I have 3 tables which I want to bring only data from table 1, if you do not have in table 1 to bring data from table 3 , if you have data in the 3 tables bring only from table 3. My problem is that…
-
0
votes1
answer45
viewsWay to get all results of SQL Command query
I am trying to select two columns of a table via sql command by running a precedent. Code : String consult = Convert.ToString(command.ExecuteScalar()); Procedure : BEGIN SELECT Value, TimeStamp FROM…
sql-serverasked 5 years, 3 months ago Levi 665 -
0
votes1
answer198
viewsRecover data from View Asp.net
I have following problem, when I place an order in the quantity field when I place a certain number I have to arrive if I have in stock in the bank, and if I have to reduce the quantity in the…
-
0
votes1
answer215
viewsEntity Framework Asp.net mvc data comparison
I need to receive the value and quantity in stock of a particular product according to your Id.By debug the product id is arriving correctly, but when I am going to assign the values to the table…
-
0
votes0
answers34
viewsDoubt Basic Relationship
Good evening guys, sorry to ask, this is the first database I’m creating, so... I have these 3 related tables, my question is whether I should keep the Customer and Employee Tables weak or leave…
-
0
votes1
answer44
viewsError while backing up wpf c#
I am having trouble performing backup on my system. I’m using WPF with SQLSERVER 2008, on that system I need to backup the data on the client’s local machine, then I’m creating the backup directory…
-
0
votes2
answers817
viewsUpdate to numbering in column order
Good afternoon! I am with a situation in my service, I am beginner in sql server and would like a help or tip if possible. I have some records (54) of a table that need to be changed its code…
-
0
votes2
answers32
viewsTimeout Connectiostring
I have a question about the Timeout value that can be passed in Connectionstring, this value is related to seconds or milestones? <connectionStrings> <add name="MyConnection"…
-
0
votes2
answers73
viewsSelect MAX with the Unix Timestamp field
I have a database in which tables have a Timestamp column (column name) which is int type, where I store the value in Unix Timestamp format. I’m trying to give a select on the most recent date.…
-
0
votes1
answer194
viewsError when changing the type of a smalldatetime column to int
I’m trying to change the type of a column of my table, which is empty, from smalldatetime to integer. Error: Implicit conversion of data type from smalldatetime to int is not permitted. To execute…
-
0
votes0
answers235
viewsSystem.Data.Sqlclient.Sqlexception Conversion failed when Converting date and/or time from Character string
Viva Pessoal, I’m new to the world. NET, C#, Entityframework (Microsoft world). I am working on a project with the mentioned technologies, initially I was programming on a VM (with Windows) because…
-
0
votes1
answer52
viewsproblems with creating stored Procedure mssql
recently I decided to change from using Mysql server database to mssql(sql server version 2012) so far so good what happens is that some things can not remake them if someone can help me finish the…
sql-serverasked 5 years, 2 months ago LuisMK 25 -
0
votes1
answer78
viewsHow to configure Mysql for multiple connections?
Hello, I have a client with 3 points of sale, 1 office and 1 server. Such a server is Mysql. When a certain export routine is performed in the office, a query is executed that takes a while to…
-
0
votes1
answer1348
viewsPHP ERROR "Uncaught Error: Call to Undefined Function sqlsrv_connect()" when connecting
Good evening, I am developing a PHP application using SQL Server but I am not able to make the connection with the database. I already downloaded the driver, I’ve put the dlls in the ini of PHP,…
-
0
votes2
answers231
viewsHow to make a SELECT keeping the first column until the records are finished
I would like to do a SELECT that repeats the first column, but when all the records are finished, change the data in the first column and repeat all the records again. Let me give you an example to…
-
0
votes1
answer3898
viewsHow to generate a counter within a select (SQL server)
I need to make a select with a case, if the condition is true use a counter that will be a new column, otherwise the counter will be displayed without any change, but I’m not succeeding, I tried…
-
0
votes0
answers447
viewsSQLSTATE[HY000] General SQL Server error: Check messages from the SQL Server (Severity 14) (SQL: select * from [product])
I have an application in Laravel connecting in the database in an SQL Server when I will make a query of all products I am getting the error SQLSTATE[HY000] General SQL Server error: Check messages…
-
0
votes1
answer184
viewsSequential update SQL
I have a table SGI01A in my database, where a column of records follows the following logic: At some point, this ordination went out of order and began to count in a "wrong" way. What was to be…
-
0
votes2
answers487
viewsBreaking lines in a list from the bank
I have this Dao that does a search to the Sql Server Database public String nomeTabela() { String nomeData = ""; String nomeAlarme = ""; String nomeRecebe = ""; ConexaoDao conexao = new…
-
0
votes0
answers465
viewsProblems with OPENROWSET in SQL Server 2016 Express (64bit)
Good morning, I’m trying to read an Excel file . xls by the OLEDB driver used in SQL Server for integrations with Microsoft.ACE.OLEDB.12 files. 0 in SQL Server 2016 Express (64bit). Using command…
-
0
votes2
answers118
viewsLast Registration by date
How do I return the latest update to a record example the record may have several status in one day but need to return the latest…
-
0
votes1
answer456
viewsApply a regex to the result of a select
I am making a query to get all the projects that are being executed: SELECT p.id FROM projetos p WHERE p.status LIKE 'Execução' An example of the result: COD00012347 COD00012348 COD01212349…
-
0
votes2
answers177
viewsRun an SQL script in transaction without it blocking other scripts accessing the same table
Can anyone tell me if there is a way I can execute an SQL Server script in transaction without it blocking other scripts that try to access the same table? I created a program in c# that accesses my…
-
0
votes1
answer64
viewsHow to count how many records there are in a Onetomany relation?
I have two tables that are related in Onetomany format, example: I have a record of table A that relates to 1 or more records in table B. I’m trying to do a query that returns how many records in…
-
0
votes0
answers135
viewsKnapsack Problem (Backpack Problem) SQL SERVER CTE RECURSIVE
Good afternoon. I am trying to develop a solution within the ERP of the company in which I work, with the objective of identifying the possibilities of INVOICES summed whose TOTAL is equal or…
-
0
votes1
answer33
viewsHow to change the date format for the between to work
I have a form type date , which returns values of type 2019-10-24 , however in my database is recorded as 20191024 , this implies that if the user puts in a search two dates equal my between does…
-
0
votes1
answer461
viewsDelete - Which is the fastest?
I need to delete from a large table some records. What is the best alternative: Use DELETE Tabela where id in (select id from @temporaria) or delete Tabela WHERE exists (select id from @temporaria…
-
0
votes1
answer99
viewsProblems with executescalar (System.Data.Sqlclient.Sqlexception)
I have the following block of code: sqlConn.Open(); SqlCommand inserirAluno = new SqlCommand("INSERT INTO ALUNOS (Nome, DataNascimento, CPF, Endereco, Bairro, " + "CEP, Cidade, IdEstado, Sexo)…
-
0
votes1
answer557
viewsHow to add Primary key to an existing column of an already populated table
I have a table already populated, in this table I have the column Deviceimei which I want to turn into Primary key. Is there any way to do this without having to empty the table ? I’m trying this…
sql-serverasked 4 years, 12 months ago Levi 665 -
0
votes1
answer1101
viewsSQL SERVER - return different columns from an Inner Join on the same row
I have the following scenario: Table users Table users On the table usuariosacessos, each line has the id user, the name of the functionality, and a field stating whether or not it has access. In my…
-
0
votes2
answers49
viewsHow do I count the amount of items in a repeated field?
I have a table with the Ctrlcarganum field that has a record of the cargo number of a truck. I need to make a consultation that brings the total of this field. Until I could make the consultation…
-
0
votes3
answers1155
viewsBring more than one line into a Subquery Sql Server
I am working with 2 consultations and would like a way to unite the 2 in one, however I am having difficulties. I have the following example: Table T1: CD PF Data Total 1 JSL001 15/03/2018 100 Table…
-
0
votes1
answer265
viewsHow to disable Identity with Linked Server?
How to disable Identity in Linked Server to not generate increment? Server table must equal local base. SET IDENTITY_INSERT [ServidorLincado].[BD_TESTE].dbo.Produto ON --Desabilita o IDENTITY INSERT…
-
0
votes3
answers645
viewsFormat date coming from SQL SERVER Database
The date that comes from SQL SERVER comes in the format like this: 20181212. I tried to format, but it only works if it comes in 2018-12-12 format. I place this date inside a table by API I pull…
-
0
votes1
answer56
viewsSQL Server: Access tables in [Cg]
I have a set of tables of "like" Cg in a database, but I can’t access it, it has two types of sets Cg and Dbo, i can access only the tables that are in dbo. Example: Tables inaccessible guy: Cg That…
-
0
votes1
answer40
viewsUse LEAD to catch the next date
I am trying to set up a query that will answer the following question: Number of customers (registration in the case) that has a reading date of 26 days, number of customers that has reading of 27…
-
0
votes2
answers460
viewsUpdate table after insert into another
I have a table called Consumption, in this table I have a column Quantity. I have another table called Product, in this table I have a column Stock. Where a new consumption is introduced, a product…
-
0
votes0
answers241
viewsUncaught Pdoexception error: could not find driver
I’m trying to connect the sql server with php7, insert the database data into the php class, insert the extensions into the php folder in xamp, and in php.ini, but this error appears when I run the…
-
0
votes1
answer569
viewsError: Must declare the scalar variable
Can someone help me with this? Must declare the scalar variable "@hospitalId". Pendenciacontroller: public async Task<ActionResult> Index() { if (!Cookies.Exists("hid")) return…
-
0
votes1
answer28
viewsCondition in SQL Server query
I’m having a doubt that seems silly but I can’t seem to solve I have a table with the following fields IdInstallation(bigint)|NameInstallation(varchar(255))|IdGroup(FK(bigint)) I would like to make…
sql-serverasked 4 years, 9 months ago Gabriel Silva 706