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
-
1
votes1
answer55
viewsRollback Sqlserver recording two separate tables
Premise: I’m using Entityframework6 for data persistence in Sqlserver. In a certain period I need to record data on two different tables, but the second table is dependent on the first example. try{…
-
1
votes2
answers1084
viewsHow to make a dynamic update to all database tables for a specific column
Personal how can I make a dynamic update to all database tables for a specific column common to all my tables? I’m thinking of using the catalog table to pull objects from the database but how can I…
-
1
votes1
answer395
viewsWhat is the difference between Table and Matrix and List in Report View?
So far in my reports I have been using tables and I link my datasets to those. But today I needed to use a List to create a card (I’m still trying to understand how it works). When to use Table,…
-
1
votes0
answers57
viewsExtract database file (varbinary) and use it on the web
I have files saved in a column of my bank (SQLSERVER) of the kind varbinary and accurate recover those files saved in that column and show-los in a modal or lower-los; however, I need to do this…
-
1
votes1
answer91
viewsSQL Constraints fits as DML or DDL?
DDL - Data Definition language: is used to create and change tables (CREATE, ALTER, etc.), right? DML - Data Manipulation language: is used for handling table data (INSERT, UPDATE, DELETE, SELECT).…
-
1
votes0
answers130
viewsLimit SQL Server memory per user
I wonder if it is possible to limit the use of memory and limit the time of SQL Server query by users: Block the execution time of the query by user. Block the memory used in the user query. The…
sql-serverasked 6 years, 7 months ago Marcus Soares 11 -
1
votes0
answers41
viewsGenerate grid with multiple records
Good morning, I need to do a grid where I need to say exactly the value of each row of it based on a column of a table in the bank, I need help because I have never done something like this. It is…
-
1
votes1
answer117
viewsPerform sub-query with data from a first
Hello friends, a question has arisen, where even entering several forums I did not succeed in Ana it, in this way see if they can give me a "light". I have a main SELECT, and some sub-queries. In…
-
1
votes2
answers284
viewsQuery that only returns the result if a field is in another table
The title may not represent the question well. I have a table with information about cars (id(CP), name, model, among others) and another one with the "Extras" (id(CP), id_carro(CS), name_do_extra)…
-
1
votes1
answer112
viewsRetrieve data from a created column
Good evening, I have a table with 4 fields and through them I do some calculations and create a new field to show these same results... The problem is that then I want to get those results and I…
-
1
votes1
answer46
viewsSQL - Crossing tables within tables
I don’t know if the title is appropriate, but come on. I have in Table A (table of consulted processes) two key fields (new process and old process) and I have in Table B my variable of interest…
-
1
votes1
answer129
viewsWhen is Trigger SQL server triggered After Insert?
When a Trigger is fired after an Insert and the Insert is within a transaction, Trigger is executed at the time of the Insert or at the end of the transaction?
-
1
votes1
answer506
viewsInsert the result of a Procedure into a new SQL table
I made the following code but I can’t insert the result into the new query table.Can I help myself? Here is the Sql code: DECLARE @Resultado TABLE ( Tabelas nvarchar(max), data_sincronização date,…
-
1
votes2
answers311
viewsBring the count of the word "DATA" from a column calculated in SQL Server
Good morning, I have a query that brings in a column calculated the information of "Data" and "Historicos", in this column I have the item Prefix (vehicle plate) and the column with the respective…
-
1
votes2
answers3449
viewsGet only last query sql server record
I have the following query: SELECT CODIGO, DTINICIO AS INICIO, DTFINAL AS FINAL FROM PFHSTAFT WHERE EMPRESA =1 GROUP BY CODIGO, DTFINAL, DTINICIO It returns as follows: 0031 2000-11-06 00:00:00.000…
-
1
votes1
answer146
viewsSelect does not return broken value
I have the following command: SELECT CAST(450/4 AS DECIMAL(15,2)) Return: 911 where the right one would be 112.5 Because of that? NOTE: My SCRIPT is in a precedent, but roughly my problem is in this…
-
1
votes2
answers433
viewsSQL server data default
Hello, I am creating a table and I need to leave the expiration date as default the date 1990/01/01. someone could give me a help? Below the code I’ve already created. create table Coordenador ( ID…
sql-serverasked 6 years, 6 months ago Jefferson Dong Min Kwak 51 -
1
votes1
answer36
viewsProblem in SQL selection
Why even if I filter to return only the fiat manufacturer, keeps returning other values? SELECT FABRICANTE, MODELO, VALOR_DIARIA FROM VEICULO WHERE VALOR_DIARIA = (SELECT MIN(VALOR_DIARIA) FROM…
-
1
votes0
answers252
viewsHow to make multiple mask Replaces per table field with T-SQL
I am performing some texts (Mask) Replaces from a field of a temporary table. I am substituting where there is the text searched for a field of other tables. Example: SELECT TOP 1000 * INTO…
-
1
votes1
answer1902
viewshow to add different record values?
I’m trying to add the value of id 1 and the value2 of id 2 which in this case would be equal to 220, as I do this consultation? ID VALOR VALOR2 ---------- ---------- ---------- 1 110 100 2 100 110…
-
1
votes1
answer213
viewsError when connecting to database [Winform/C#/SQL Server]
My C# teacher taught us a new technique today, one does not need to inform Connectionstring itself, the program would go to the document folder and pick up the file . mdf (SQL Server) and open the…
-
1
votes2
answers112
viewsHow to run a subconsultation on LINQ C#?
How to run a subconsultation on LINQ C#? SELECT ap.ID FROM Aplicativo AP WHERE AP.Tipo IN (2,6) AND AP.ID NOT IN (SELECT filhoID FROM relacoesobjeto WHERE filhoclasse = 555)…
-
1
votes1
answer105
viewsMount an ALTER TABLE script
I have this select that returns me the name of the tables that interest me: SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME LIKE '%_AUD' AND COLUMN_NAME = 'REVTYPE' GROUP BY…
-
1
votes1
answer8375
viewsUse CASE in a WHERE clause
I need to use a condition within a filter parameter in a report. Basically the rule is determined by a vachar field that the value of it is’T' or 'P'. I tried a solution like below but it did not…
-
1
votes1
answer694
viewsIs it possible to consume data from a webservice within a Sqlserver directly?
I have to migrate from one Mysql database to another in Sqlserver. In this migration, I have the following problem: not all address records are complete but I have the zip code of most of them. My…
-
1
votes1
answer1158
viewsList tables that have Trigger
Is there any way to know which tables have at least 1 Trigger ? For example, I have a system with 10,000 tables, and I would like to know which one has Trigger.
-
1
votes2
answers788
viewsProblem with CASE WHEN SQL-SERVER
SELECT CASE WHEN VALOR > 0 THEN VALOR ELSE "Não tem" END AS NOMECOLUNA FROM BLABLABLA I am having an error where it is not possible to convert "has not" to int. The point is that I wanted it to…
-
1
votes1
answer222
viewsQuery SQL returns records only after 2 days prior to today
Guys, as I am new to SQL, I need a help. I need to bring only the records that have not been moving for more than two days. The query below is bringing everyone without this condition. I even ran a…
-
1
votes2
answers2225
viewsHow to take the sum of an entire column in SQLSERVER
I need to take the total value of the VOL field (image below), it is already generated by the SUM function. It can be in another query. All periodic tithes are required. ex: total = VOL(7,6890028)…
-
1
votes1
answer711
viewsConnect to sql database a postgres database
Scenario: I have the postgres database A, but I need to connect to the database from sql server 2017. How can I do this?
-
1
votes1
answer492
viewsC# BD . mdf connection string
Good evening, you guys, I have a database . mdf in a Windows Forms and want to make the connection string of it, can anyone help me? My version of Visual Studio is 2015 and the file is: C:Documents…
-
1
votes1
answer129
viewsName of a Role with accent in the Identity database
The need to create a Role with emphasis on the table of Roles of Identity in the database: "Technical". My question is whether this can generate further problems, perhaps at the time of checking…
-
1
votes1
answer52
viewsWhat I need is to take the primary key from the Phone table and insert it into the FK of the Client table. How do I?
CREATE TABLE Cliente ( id_Cliente INTEGER PRIMARY KEY IDENTITY(1,1), nome_Cliente VARCHAR(50), fk_ID_Telefone INTEGER ) CREATE TABLE Telefone ( id_Telefone INTEGER PRIMARY KEY IDENTITY(1,1),…
-
1
votes0
answers28
viewsReturn Datalayer value
Good afternoon. I have a precedent that makes some commands and returns 0 = success; 1 = without success; alter PROCEDURE [dbo].TesteRetorno ( @DS_NOME_ARQUIVO_SINCRONISMO AS VARCHAR(200) = null )…
-
1
votes1
answer645
viewsJDBC Java Web and SQL Server 2014 connection
I am starting the development of a portal using JAVA Web and database in SQL Server 2014. I have never worked with SQL Server and there is a problem that I am unable to find the solution. Here’s the…
-
1
votes1
answer152
viewsConnect MS SQL in PGADMIN
Hello, good afternoon! I need to know if there is any tool, script or anything else from where I can have the following scenario: I have a MS SQL database but need to manipulate it through pgAdmin…
-
1
votes2
answers1654
viewsVariable period date SQL Server
Below I have the following code where I search in a table all the data within the specified period in the declared variables. However, a specific client has a different month closure, in this case,…
-
1
votes1
answer69
viewsDoubt query - SQL Server 2012
Good afternoon! Guys, I don’t know if it’s possible, but I wanted to know how to get a record of a line in another line. I’ll illustrate. In the query below is coming out like this. Projeto…
-
1
votes2
answers1525
viewsBrowse previous record - SQL Server 2012
I need to bring only the records where the previous status was 1, but which is currently 0. I have a table called solicitação containing a field called VencimentoPausado, where this field values are…
-
1
votes1
answer1617
viewsHow to generate Nfe/NFC-e/CF-e/CT-e Key Checker Digit
How to Calculate the Nfe Key Checker Digit? For example, which Key checker digit has 43 positions: '2411050954052500019455001000000709124205076'
sql-serverasked 6 years, 4 months ago AndyDaSilva52 11 -
1
votes0
answers369
viewsHow to get the return of an sql query using nodejs
Good afternoon, I’m venturing into nodejs and I’m doing some pranks and I’m having a hard time getting the return of an sql query. I found some examples on the internet and even work (the result is…
-
1
votes1
answer34
viewsReturn the value to the left
good morning. A question, how can I return the results of a column that contains only the values to the left that start with the word 'car' for example? I am using sql server. Thank you.…
-
1
votes0
answers35
viewsPerform sorting by a given field of a given table
I have the following syntax The instruction below perform sorting by field Lot Number table Lot var lvmLotes = db.Lotes.Tolist(). Where(x => x.DataAbate.Date == Search). Orderby(x =>…
-
1
votes1
answer157
viewsPostgre - Field Id (Integer) of a table can go from 1 to how much?
I have a table in Postgre whose Id field is Integer type and primary key. As records are saved, the numbering goes from 1 to how much? I’m used to the Dataflex database, where table records (by…
-
1
votes2
answers235
viewsCase in Where using SQL Server
I have the following code that lists certain trade agreements. You have the Yes or No option. DECLARE @Opcao VARCHAR(7) SET @Opcao = 'S' SELECT * FROM BLA BLA BLA WHERE ((('{Opcao}' = 'S') AND…
-
1
votes1
answer76
viewsTemporary table with underscore
I am trying in my service to create temporary tables as I have always learned, putting # in front of the name I want. But I don’t know what happens when I create one, it puts a huge underscore and…
-
1
votes2
answers763
viewsselect multiple columns group by 1 column
I have a table with 300 thousand records and within it there are several different fields, I would like to take the line that contains the largest OUTGOING DATE calculated for each CPF_1 what I…
-
1
votes2
answers1323
viewsBring results equal to 0 as blank value in a query in SQL Server
I have a query below that the records that have nothing is coming with 0. I wish it could come blank. Example: select F.C37 [Pontuação], ISNULL(count(distinct TD.UsuIDCliente),'-') [Qtde_Clientes…
-
1
votes1
answer51
viewsVersioning of the Procedure
I’m having a kind of conceptual doubt. I am currently working on a project where I will have to check the calls of some api’s. For example: Urls: /api/V1.0/Chamados/1220 /api/V1.5/Chamados/1220 The…
-
1
votes3
answers241
viewsIdentifying SQL brothers
I built this link as an example of where I want to get http://sqlfiddle.com/#! 9/72f4b5/4 I have the student table. I have the table with the sibling ids My problem is, I need to make a select so…