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
votes1
answer122
viewsHow to check if there is a number in several fields of a table
I have a table in a Sqlserver database that simulates a bingo card. In total there are 25 fields that represent the card: n1, n2, n3, ..., n25 Let’s say I drew the numbers 5, 28 and 67, as I do a…
-
2
votes1
answer49
viewsHow to avoid Inserts Simultaneos
In a sales system I realize a INSERT registering the cover of the order (order without the items) soon after the cover registration SELECT MAX to return the last id inserted to use this id as…
-
2
votes3
answers133
viewsSUM of one table minus the SUM of another in the same field
Hello, I am self-taught and already do some consultations in SQL but "stuck" in this. I need a list where one of the fields should show the total of a column, minus the total of another that is in a…
-
2
votes1
answer194
viewsScript to determine a desired column
Good morning! I’m trying to make a script where doing 2 joins, it shows me 3 columns. I mean, what I want is to get the email do lider. However it does not have a specific column, it is inserted…
-
2
votes1
answer185
viewsHow to load SQL Server data into a combobox in Android Studio using Volley?
Currently, for testing purposes, I am using a spinner, but I now want to implement the data that comes from the BD. Is it possible to put in this same spinner or should I create another application?…
-
2
votes2
answers210
viewsAdd Identity field in already filled table
How do I resolve the situation below: I have a table where the data were entered in the following order: INSERT INTO teste(Nome) VALUES('C') INSERT INTO teste(Nome) VALUES('D') INSERT INTO…
sql-serverasked 5 years, 8 months ago Nádia Teles 91 -
2
votes1
answer91
viewsCount how many children the father has (Self Related)
Table: FilhoID INT PK, PaiID INT FK Query: SELECT FilhoID, PaiID, (SELECT COUNT(PaiID) FROM tabela WHERE PaiID = FilhoID) as 'Total Filhos' FROM tabela My doubt: My SELECT within the SELECT, I…
sql-serverasked 5 years, 8 months ago LeoHenrique 954 -
2
votes0
answers186
viewsC# application in visual Studio does not connect to Sql database via network
I’m facing a problem with my application. I made the application without any error, managed the installer, but when I run it, it does not connect to the bank via network, but in Visual Studio it…
-
2
votes1
answer671
viewsSQL save and return Base64 image
I am saving an image in SQL Server using the varbinary field(max). However, when I run the query to return to the front, I can only return by converting the field to sweep. My question is how to…
-
2
votes2
answers1278
viewsString or Binary data error would be truncated - SQL
This is the structure of my table; CREATE TABLE Pessoaldesenv.dbo.Conformidade ( [ID numeric] numeric(19,0) IDENTITY(1,1) NOT NULL, Validacao int NULL, Arquivo varchar(100) COLLATE…
sql-serverasked 5 years, 6 months ago wladyband 4,694 -
2
votes2
answers66
viewsSee table by period
I have two tables, "Contact" and "Pedvenda", how can I make a query that manages during a period, for example, from 01/01/2019 to 30/01/2019 the quantity of sales between 10:00h and 16:00h each day…
-
2
votes2
answers75
viewsLooking for a group of duplicate records
I have the table below: declare @order table (idOrder int, altcode varchar(17) ) insert into @order values (1,'11111111111') insert into @order values (1,'22222222222') insert into @order values…
-
2
votes1
answer769
viewsCheck if a certain value already exists in an SQL Server table
I am trying to check whether a certain value is already inserted in my table or not. Example : Check to be determined Imei already exists in the column Deviceimei. I am trying to select Count, to…
sql-serverasked 5 years, 4 months ago Levi 665 -
2
votes1
answer60
viewsError with another bank’s Foreign key
I’m trying to put Foreign key related to tables from another database (I’m performing tests and sometimes I need to delete the main database). However it presents the following errors: Message 1763,…
-
2
votes1
answer60
viewsHelp in SQL query for LINQ
I have a problem/difficulty, I have this following SQL query that I need to transform it into LINQ, but I am having problems in LINQ COUNT(). select m.id_marca, m.ds_marca,…
-
2
votes3
answers454
viewsReplace Sql in the middle of the text
SQL Server Database , Column is a Varchar(9) . And I need to fix this data because I need to filter only by people over 50 years old and that way I’m not getting , more in case someone knows a…
-
2
votes1
answer175
viewsSelf Join subquery approach
I have a attendance list table, where I need a list identifying who was present: Table structure: create table lista_presenca_usuario ( id int identity(1,1), usuarioId int, dia int, turno int,…
-
2
votes0
answers335
viewsConnection error with sqlserver when editing Connection Timeout in connectionString
I have a Webapi where I need to search the amount of records of a given table in sqlexpress on the production server, local I have no problems at all. I’m using ADO pure and with ExecuteScalar,…
-
2
votes2
answers209
viewsSQL server random numbers
In this code only returns a value, I need a list of values, as I do? declare @letras varchar(max) = 'ABCDEFGHIJKLMNOPQRSTUWVXZ1234567890' declare @tamanho int = 10 ;with cte as ( select 1 as…
sql-serverasked 4 years, 10 months ago Lucas Lira 41 -
2
votes0
answers155
viewsSSIS error: Cannot load script for Execution
Executing the data load generates the following error: "Cannot load script for Execution". The data load executes a Script Task. In this Script find a CSV file, in which it takes the date of the…
-
2
votes2
answers48
viewsSQL showing records if they only meet different conditions than usual
I have a slightly different situation, tried different conditions but none brought the desired result. My need is this: I have a base containing authors of books and their respective works. I need…
-
2
votes2
answers65
viewsList data from Procedure sqlsrv PHP
Good morning, someone with experience in PHP and microsoft sqlsrv drive ? I found it difficult to display data from a Procedure in SQL SERVER with the "Microsoft sqlsrv driver". Something strange is…
-
2
votes2
answers131
viewsInsert data with pymysql into a mysql database error. How to resolve?
seqteste.txt or List: >gb:KX262887|Organism:Zika virus|Strain Name:103451|Segment:null|Subtype:Asian|Host:Human GTTGTTGATCTGTGTGAATCAGACTGCGACAGTTCGAGTTTGAAGCGAAAGCTAGCAACAGTATCAACAG…
-
2
votes1
answer21
viewsSQL Index Unico
I have a question on SQL Server. I have the following table, ID (integer Key), Name (nvachar), CPF (nvachar, with index unico). If I insert with the CPF that already exists, SQL returns with error…
-
2
votes2
answers77
viewsGroup a conversion list within SELECT
I have a doubt in the SQL Server, I have a product table and another with a conversion list for each product I have a conversion list for that product. I need a product list with the conversion…
-
1
votes2
answers443
viewsPaging results in SQL Server 2000
Sometimes I need to make queries in SQL Server 2000 and paginate the results but there is only the clause TOP that limits the number of records returned without an interval (offset) other banks like…
-
1
votes3
answers435
viewsProblem with users when publishing application
I am using SQL Server 2012, and when publishing my application, both on the client server and on my pc everything works well. As connection strings for the BD are correct, everything looks good. Now…
-
1
votes2
answers1405
viewsBest way to add multiple order items to a table
When I add a request to the table TB_PEDIDOS, TB_PEDIDOS: ID_PEDIDO, DATA_PEDIDO, ID_CLIENTE I also need to add order details to another table: TB_DETALHES_PEDIDOS: ID_PEDIDO, ID_PRODUTO,…
-
1
votes1
answer47
viewslocaldb usage with team Foundation server
I have a visual studio solution, which contains several C++ projects and an SQL DB project, which is published in a localdb instance. Version control is done using Team Foundation Server. My…
-
1
votes1
answer293
viewsUpdate if value does not exist
I have these two tables in the database (SQL Server) Table Banks ID CODIGO NOME 1 246 Banco ABC Brasil S.A. 2 075 Banco ABN AMRO S.A. 3 025 Banco Alfa S.A. 4 001 Banco do Brasil S.A. Table Account…
-
1
votes1
answer445
viewsGenerating tables in sql-server with Hibernate
I am migrating a Java system to work with 2 or more databases. I created the tables for Firebird using Hibernate without many problems. The second database was not successful. SQL-Server. Because…
-
1
votes1
answer389
viewsDatabase entry error, how to solve this case?
I am trying to insert a form with various data, some booleans, radiobuttons, datetime etc. I need to know if everything is correct, I am picking them up via FormColleciont. Controller: [HttpPost]…
-
1
votes2
answers326
viewsDrivers for bank connection via ASP Classic
Good afternoon. In the Connection string of our web application, we always use the Driver {SQL Server}. We have other options like {SQL Server Native Client 11.0}. What are the decision-making…
-
1
votes1
answer424
viewsConnection via PHP to an SQL Server 2012 database
My problem has some variants: I have a website built on joomla, which is hosted on a linux server. The administrator where I have hosted my website has already informed me that it will not install…
-
1
votes1
answer164
viewsSql Timeout with Webmatrix.Data.Database
Using the Webmatrix.Data.Database namespace, I am having problems executing a query that returns a lot of data, resulting in a Timeout. How can I increase the timeout of this query? Code example:…
-
1
votes1
answer1287
viewsSecurity and authorization using Roles
I am finishing my application by configuring the authorization and permission of the application users. My idea is to move the layout so that the menus and submenus are only visible to those who…
-
1
votes1
answer219
viewsMultitenancy application and structure
Saas applications are getting higher, reducing costs, maintenance, etc. We know we have the concept: Multitenancy (http://msdn.microsoft.com/en-us/library/aa479086.aspx) It’s them: By Column: Place…
-
1
votes1
answer654
viewsInsert data into Active Directory via SQL SERVER
I’m working with integration between Sql Server and Active Directory. I can already import AD information through scripts. I would like to know if it is possible to enter information on AD users…
-
1
votes1
answer2405
viewsLogin failure for user "NT IUSR AUTHORITY"
I have a Webservice application running on IIS, but how much I try to consume from this error: System.Exception: Login failed for user 'IUSR NT AUTHORITY' I tried to add this user in the database,…
-
1
votes1
answer120
viewsRun Trial with Codefirst
I am trying to run a trial on ASP.NET MVC with Codefirst. I saw some examples on the internet but they are not working, someone can help me? Follow the code I’m using, the Procedure just copies some…
-
1
votes4
answers2318
viewsTable load of a different seat
I have a bank called STG_RUP and another called RUP. I created some entities in the RUP and I need to feed these entities with data from the entities that are in STG_RUP. How do I do this? The…
sql-serverasked 10 years, 3 months ago pnet 14,727 -
1
votes2
answers340
viewsError in converting dates during an Index
I need to load a table into a database with data from another table and another database. It turns out that in the Datetime field is giving a conversion error, because the data of the other table is…
-
1
votes1
answer95
viewsSQL Server versioning integrated into the Entity Framework
In the company I work have chosen to create the models from the database with the Entity Power Tools. We have an online version of our application and locations for testing and development. When…
-
1
votes1
answer387
viewsIs there any technique for synchronizing a SQL Server database structure?
I had some problems recently when making modifications in the type approval environment and for bureaucratic reasons these modifications could not be inspected in the production environment and were…
-
1
votes1
answer4533
viewsHow to bring only the records that have no association in the second table?
Personal I have a query that returns the number of registered phones in each state,parents and also brings the number of customers who have no phone registered in each state,parents but I would like…
-
1
votes1
answer860
viewsSaving hexadecimal data in the database
I need to register in the database a document or image in hexadecimal format and then recover these data by converting them back to correct format.
-
1
votes1
answer2363
viewsI cannot change column type -> Object Depends on the column in question
I need to modify the column type of a client table, however this change will be made through a program written in VB.Net and therefore needs to be done via SQL command. The point is that when using…
sql-serverasked 10 years, 1 month ago Cleiton Ribeiro 757 -
1
votes2
answers815
viewsCan a worse cost query be a better performance query?
Context Here at the company we have a very complex query that encompasses several business rules, for presentation in a Workflow and for now I am evaluating it on Sqlserver. The performance of this…
-
1
votes0
answers85
viewsTransactions on SQL Server, how do they work?
I’m having a hard time understanding this content in college and finding good materials to understand, could someone explain to me in a better way how transactions are specified and defined the…
-
1
votes2
answers330
viewsHow to execute C# query for request control
I am new to programming and need to add some functionality in a C# Asp.net. One of them is a control that prevents the user from proceeding with the request if he has any pending in the system. I…