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
answer523
viewsInsert data into a table with Foreign key in the ID
I will try to be as objective as possible so not many codes will put (because the original is really too big). I am making a progress of simple registration that has: - 1 datagridview to select the…
-
0
votes4
answers3265
viewsSelect only 1st row of table
I need to select only row 1 of the table, I’ve used the DISTINCT and it didn’t work follows the Query: select Max(remessa.dt_uso_inicio) as DATA_REMESSA ,min(dt_entorc_oficina)DATA_ABERTURA…
-
0
votes2
answers838
viewsSelect picking up previous line
What I have to use in SQL SERVER 2008 to get the line before a certain enclosure. For example if in my Where below if the alert is = to 99 want to know the alert and the speed before the alert.…
-
0
votes1
answer1324
viewsSelect the line with the oldest date within this query between the repeated values
select e.nm_equipto as EQUIPAMENTOS ,Max(remessa.dt_uso_inicio) as DATA_REMESSA --,(SELECT MAX(DT_ENTORC_OFICINA) FROM ORCOS)as DATA_ABERTURA ,MIN(dt_entorc_oficina) as DATA_ABERTURA ,o.numero as…
sql-serverasked 7 years, 8 months ago Jander Helius 41 -
0
votes1
answer1537
viewsMedia calculation between SQL Selects
Good Afternoon Please help me out Error in the Syntax Msg 102, Level 15, State 1, Line 2087 Incorrect syntax near 'TAB'. --TARIFAS --Calcular Média Tarifada BEGIN TRY DROP TABLE #TARIFASINDMETRO END…
-
0
votes1
answer85
viewsMerge select to totalize results
How to sum up the stored quantity of these products to be able to compare with the total order quantity for resale "QTD ORDER". How can I find the stored total and link to the result? Select: SELECT…
-
0
votes2
answers974
viewsInsert several Items with the same IDPEDIDO Sql Sever
Hello How can I enter multiple items for a single Primarykey autoincrement ID of there will still be columns of the Idproducts where I want to insert several items for an Id_request as I do this…
-
0
votes1
answer110
viewsGrouping data by period
I am making an appointment at the bank, to return the entry of products per hour (from 00:00 until 23:00) during a given day; follow the consultation: SELECT CONVERT(VARCHAR(13),DATA_ENTRADA,120)+…
sql-serverasked 7 years, 7 months ago mrkoos 1 -
0
votes0
answers470
viewsEntity Framework 6: Connection Error
I created a project with Entity Framework 6 and another Console Application type project, containing the following connection string in the App.Config file: <connectionStrings> <add…
-
0
votes1
answer880
viewsQuery all sql tables
Good night I’m starting in the career of developer and I’m creating an application that will read an xml file. I am having difficulty passing a command in the sql database that returns all tables…
-
0
votes1
answer9363
viewsRun function that returns multiple values and based on these make the main SELECT - SQL Server
I have the following function in SQL Server that returns the name of each column of my table: CREATE FUNCTION dbo.FiltraNomeColunas(@FiltroColuna VARCHAR(200)) RETURNS VARCHAR AS BEGIN DECLARE…
-
0
votes0
answers254
viewsUnable to locate column 22276451.
Good morning, I’m developing a code that can accept the X and Y values of a Chart I entered in Asp.net. For this I made a query to sql server so that it could be returned to a column media, until…
-
0
votes2
answers5013
viewsHow to add two columns?
I have 2 subselects, in SQL, that bring 2 different information, with the sum data. How to add the 2 "sums" and bring in a new column, or a single column? CASE WHEN sd3.D3_UM = 'PC' THEN (SELECT…
-
0
votes2
answers355
viewsError 1 The type or namespace name 'Datareader' could not be found (are you Missing a using Directive or an Assembly Reference?)
Good afternoon, I was performing a code to query my database when I appeared these error: Error 1 The type or namespace name 'Datareader' could not be found (are you Missing a using Directive or an…
-
0
votes2
answers85
viewsChange column data
How can I change column data? I wanted to change some bits to false but I don’t know how. using (SqlCommand cmdadd = new SqlCommand("INSERT into Usuarios (Cadastro) VALUES (@Cadastro)",…
-
0
votes1
answer664
viewsPush notifications
I am developing a program in which several users will use, and would like to develop a system with notification Push, for when some user performs a Insert in the database. I would like it to be, for…
-
0
votes1
answer39
viewsDoubt - Query SQL Server 2012
I have a query below that I need to bring inside the case only when the field Tarvencimento is less than today’s date (so far I managed to do), however, only when today’s date is 5° day after the…
-
0
votes0
answers52
viewsTransform the rows of a column - SQL
Someone help me with the following question. Generate ".sql" extension file with script that transforms the lines of a column in a variable string, with its values separated by commas, for example:…
-
0
votes0
answers360
viewsSynchronize Mysql and SQL SERVER via PHP script
I need to synchronize SQL Server (Master) with Mysql (Slave). I have already found some ways to do this on the internet, such as the native feature of SQL Server "Linked Server" or that APP for…
-
0
votes0
answers25
viewsdatabase vendor code:521
I am unable to run these query in sql 2008 I took the test in 2014 and it worked Could someone help me? I’m too layman to bridge to find a solution. Follows the query: SELECT D1_COD, D1_FORNECE,…
-
0
votes1
answer707
viewsBulk insert into a table
I have two proc’s that my VB system already uses. One for Insert and one for Update. I need to use it now, directly in the database. The target table has a composite key, as follows. A field called…
-
0
votes1
answer59
viewsCondition(if) does not work for entering data
I did this query to insert data. I should only insert data if there is nothing in the OIT1980 table. Then I mounted a cursor and walked and put an IF. If I remove the IF, it works, but if I leave it…
-
0
votes1
answer204
viewsHow to do column operations where you give nicknames?
I have the following hypothetical consultation with the bank: SELECT dinheiro_na_carteira, (SELECT sum(despesas_pagas_carteira) FROM DESPESAS WHERE id = X ) as despesas FROM RECEITAS WHERE…
-
0
votes0
answers254
viewsConnect By no Sqlserver
I have a query that works on Oracle but is not working on SQL Server. The table I have recorded has an initial date and final date on the same line, but when it goes from one day to the next I…
-
0
votes1
answer958
viewsCompare variables with values from an SQL Server table C#
I have 1 table with 2 columns (Code and Value). I’m writing a code in C# and I have a variable taxpercentage. What I need is to return the column value Code, when the variable taxpercentage is equal…
-
0
votes1
answer135
viewsHow to migrate data between tables referencing ID?
I have a table called Clipping in my database containing various data, including binary data of an image in a column varbinary(max). I need to migrate only the binary data column to another table…
sql-serverasked 6 years, 11 months ago Kaizonaro 671 -
0
votes1
answer73
viewsUpdate and maintain update code when it repeats
I did this update: declare @rx_num varchar(20), @id_oit_max int, @id_exm_rea int, @id_xfc_novo int, @id_xfc int = 0 declare oit_cur cursor for select pl.rx_num, er.id_exm_rea, er.id_xfc from…
-
0
votes0
answers232
viewsPython + Django list + HTML select option
Good morning guys, I need your help with a code I’m developing in python + Django Here’s my problem: I have a function in views.py in which you select a Name in the client table and place the…
-
0
votes0
answers165
viewsInsert SQL Server Column does not receive value
I’m trying to get the Insert in a simple table, but a field of it, it’s not saving the value I’m passing it, and the weird thing is that all the other columns get it right. Example INSERT…
-
0
votes1
answer84
viewsUpdating the SQL database in the MVC project
I made a column change in my SQL BD in my ASP.NET MVC project. I changed a column of Cliente_RG (INT) for Cliente_Bairro (String). In SQL the change was OK. In the project, in all tables (think) the…
-
0
votes0
answers998
viewsTake data from excel spreadsheet and insert into SQL SERVER database
I want to know if you have how to take the records of a spreadsheet and play for an SQL-SERVER table, there is this possibility ?
-
0
votes0
answers353
viewsBulk Insert bringing information without accentuation
Expensive, Good Afternoon! I have a problem when I perform an excel Bulk Insert for Sqlserver, I have a column called city and when I do the Bulk Insert and include the information in the database…
-
0
votes1
answer506
viewschange data type ntext to text, SQL Server
I need to change the data type of a field that is in "ntext" to "text". The reason is that I’m having trouble pulling this value from the database and generating a PDF with the php DOMPDF component.…
-
0
votes1
answer6479
viewsGenerate MER from a Database
I have a Database backup and for lack of documentation I need to generate his MER. I remember reading somewhere that there are programs that do this reverse engineering and generate the MER. Could…
-
0
votes1
answer2160
viewsHow to remove a SQL Server Constraint
I’m having a problem removing a Constraint from a table. Objective is to delete the Constraint to delete a table. The problem is: I have an Income table that is associated with Extra Income. This…
-
0
votes1
answer38
viewsError while restoring external database from Asp.net mvc application
I’m trying to restore a bank SQL that I created on a provider that does not have the option Webdeploy. And my goal is to boot a database using ASP.NET MVC with EntityFramework. Well, when you put…
-
0
votes1
answer677
viewsPermission Sql Server User
I need to create a user inside the Sql Server login with access to the Database, but I don’t want to release any other resource (such as Security, server role, Sql Agent, backup, etc). This user is…
sql-serverasked 6 years, 11 months ago MMoura 9 -
0
votes1
answer255
viewsAccess Database on client machine from Web Application
Hello, good afternoon. I’m developing a system that has only one code for several databases. The system already implemented almost all, but when I started to test the connection on the client…
-
0
votes1
answer72
viewsSearch for values with priorities
I’m looking for a search and I’m not finding the right logic to filter the results I want. I have a table with all the expiration registrations of certain equipment. My problem is related here: The…
-
0
votes1
answer147
viewsBring the word HISTORICAL when the line date is less than the previous dates,
I have a query where I should register the lines with error with the word Historical, the lines that bring the date LESS than any of the dates of the previous lines should present the word…
-
0
votes0
answers36
viewsCPU usage without an explanation
in our database we use to report the Performance Dashboard Reports, and we are receiving this type of peak.. What bothers us is the issue of the orange bar. Does anyone know how we can find out what…
sql-serverasked 6 years, 10 months ago Fabio Aragão 135 -
0
votes1
answer6140
viewsCreate new table from another in sql server
I’m doing this query: CREATE TABLE nova_tabela AS SELECT * FROM tabela_copiada; I’m getting the following error: Incorrect syntax near the keyword 'SELECT' Already researched the syntax seems to me…
-
0
votes2
answers674
viewsSELECT with repeated field
I’m having trouble executing an SQL query. The consultation is: SELECT DISTINCT…
sql-serverasked 6 years, 10 months ago Flávio Kowalske 215 -
0
votes1
answer878
viewsDelete in sql - Inner Join
As is the syntax of a query using Inner Join delete in sql, to compare two table code and exclude being equal? Table itemVenda. in table itemvenda a sale was registered whose code is 4. To execute…
-
0
votes2
answers267
viewsStore Procedure not working properly
Galera created a Storeprocedure called, Cancelarnota, that through the use of cursors, back the products to the stock, pass the status of the item to canceled. This working, however, is not setting…
-
0
votes1
answer1224
viewsSQL Server connection in the Laravel
Guys, I’m making the following mistake: sqlstate 08001:[Microsoft][odbc driver 11 for sql server] tcp provider: no connection can be made because the target machine actively refused them. I am using…
-
0
votes0
answers323
viewsC# Windows Forms - Integrated Database
I will develop a Desktop application, and this application will make access to Local Database, my question is: If I make an application that accesses SQL Server normally, when I generate the release…
-
0
votes1
answer57
viewsFunction max E Cast Joins Sql Server 2008 R2
I need to convert an Nvarchar field to Float in a survey, and take the highest value. this function works SELECT MAX(valor) from [Enops].[dbo].[Tbl_Pulsomedia15_Vazao_Eta_B_Bentes] Where valor…
-
0
votes2
answers273
viewsCondition in the trial
Good afternoon. I have a filter, I have several filters. one of these filters is @ST_TIPO -When I get by Parametro BSP I want to filter just by PT.ST_TIPO = 'BSP' -When I get by Parametro 'DIS' I…
-
0
votes1
answer149
viewsHow to Recover SQL Server Data Correctly?
I created a CRUD simple using the ASP.NET MVC and I can save my logs normally. If I look in the database, my date (Dating) was stored like this: 2017-06-01 00: 01: 23.750 But when I try edit the…