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
votes2
answers337
viewsAdd WITH query inside another query - SQL Server
Guys, how to add the query below as a subconsulta. Consultation with WITH: WITH dias AS( SELECT CAST('2017-06-26' AS DATE) AS dia UNION ALL SELECT DATEADD(DAY, 1, d.dia) FROM dias d WHERE d.dia <…
-
1
votes1
answer2093
viewsHow to format numbers directly by SQL
Gentlemen, my numbers are coming out without formatting when I perform the select directly at the bank, they are coming out as follows: REALIZADO META 61274436,2090003 80000000,00 How can I make…
-
1
votes2
answers730
viewsIn an SQL query, bring line values in a single line, field
I need to make one query that brings values of 2 lines in a single Ex: id | valor | banco 000001 | 1000,00 | caixa 000001 | 1000,00 | bradesco I need you to leave like this: id | valor | banco 1 |…
-
1
votes2
answers89
viewsSQL SERVER - Calculus
I have a question to put together a panel of indicators and I’m not getting out of it. I basically have two tables. Table 1: CONTRACTS Fields: Company ID, Contract ID, Product ID, Quantity Table 2:…
-
1
votes1
answer62
viewsHow to view the columns of a system view in SQL Server?
Well I come from Oracle culture and want to learn about SQL Server. I would like to know how I see the columns of a system view, for example: I tried with sp_help teste.INFORMATION_SCHEMA.ROUTINES…
-
1
votes3
answers157
viewsShow comments table
Good morning guys, I wonder if it is possible to list in SQL-SERVER all comments of my "table", not comments of the column, but only of the "tables""
-
1
votes1
answer142
viewsCopy table A column to table B sql
Good afternoon Personal, I have two tables and I need to make a SELECT to link the code of the cities that are in table B with the cities in table A. I am using the query: select a.Cidade, b.Cidade,…
-
1
votes1
answer419
viewsHaversine formula for SQL SERVER
Guys, I have an Android app that uses Google Maps API. On the map, I get data from an SQL Server database. I need to create a KM radius where I only upload the database data that’s inside this…
java android sql-server web-service google-mapsasked 7 years, 2 months ago Gabriel Moreira Carvalho da Lu 13 -
1
votes2
answers60
viewsConnection to database on Amazon
Good afternoon, I have a sqlserver database hosted on Amazon, and can’t perform the connection in php, there is some specific way to do this? I tried the connection this way: <?php $servername =…
-
1
votes2
answers415
viewsTrigger automatically blocks the table (LOCK TABLE)?
About TRIGGER in any table: To TRIGGER blocks (LOCK) the table until the end of its execution? If not, when should I block it out? How do I do that blockade?…
-
1
votes2
answers600
viewsHow to use Order By before Union in sql Server using this query?
I have this query: SELECT * FROM ( SELECT distinct db_name() as 'Banco_de_Dados',g.KM_SIMBOL, fotos = COUNT(*) OVER (PARTITION BY d.globalid ORDER BY d.globalid),d.GDB_FROM_DATE as Data , g.RODOVIA…
sql-serverasked 7 years, 2 months ago Gladiador 345 -
1
votes2
answers1009
viewsRepeat previous rows when there is no record in SQL SERVER data
Friends, good afternoon! I came across a problem at work today, and I still haven’t found a solution to it. As I do not have much experience in the database area I am having difficulty to solve this…
-
1
votes1
answer74
viewsProcessing of graphical query via javascript
Good afternoon, I have a query in my system where it generates a chart. In the first chart caption is as Undefined, I was trying to redo my query only that it was not coming with the same values. I…
-
1
votes1
answer698
viewsPython Connect Sql With user and "token"
I have an application in Flask and am using Sqlalchemy to access SQL Server. I would like the connection to the database to be made by a generic user and the password is a "token", I thought it…
-
1
votes3
answers1529
viewsEliminating duplicate values in SQL
I have a problem in a query, because there is only one field that differs from one data from another. I have tried using group by, order by, having, I searched in several forums, anyway, I tried…
-
1
votes2
answers262
viewsSet default value when creating an SQL table
I am studying SQL Language and I am having some problems in the creation of tables, I can not set a default value in a column, whenever I apply, indicates syntax error. Can anyone help me? I have no…
-
1
votes1
answer363
viewsQuery with Procedure, passing table name as parameter in sql server
I would like to create a precedent where I will pass the table name and Table id as parameters, how could I do that? I have my example of how I would like to do DECLARE @NomeTabela VARCHAR(50) =…
-
1
votes0
answers250
viewsIs there a Sqlite PHP simultaneous connection limit ?
I currently use Mysql on my server with a limit of 50 simultaneous connections.. thought to use SQL Server which in turn has no simultaneous connection limit but is very expensive!!.. So I thought…
-
1
votes1
answer92
viewsWhen clicking the button check whether the value of the textbox contains in a table column
How can I check the textbox if it contains this value within the table in the Database column when clicking the button? I made this code, but I didn’t succeed: SqlConnection conn = new…
-
1
votes1
answer532
viewsSeparate values from a multi select in columns
in my system, I have a multi select as they can come in the image below: And I export this variable in this select SELECT REPLACE(p.Argautor, ',', ';') AS Argautor FROM jud_Processos p LEFT JOIN…
-
1
votes1
answer267
viewspass external parameters to sqlcmd via batch
I used in the oracle so, I wonder if you have any similar method for the sqlserver (sqlcmd). Batch sqlplus.exe system/123@localhost/xe @..\CRIA_TABELAS.sql "%last_bill%" file . sql SELECT * FROM…
-
1
votes1
answer68
viewsSQL Server Doubt 2012 - Query
I am having a hard time. In the consultation below, you are bringing in this way. Tarefa_Inclusao Tarefa 167909 167920 SELECT TarIDInclusao [Tarefa_Inclusao],tarid [Tarefa] FROM Tarefa WHERE TarID =…
-
1
votes1
answer1942
viewsTRANSACTION - How to correct a shipping error?
I think you can understand what I’m trying to do there: This method will make a foreach for each item in my movement list, and send each as a parameter to the method that will save them in the BD. I…
-
1
votes2
answers801
viewsupdate sql relating a column with external value
Good morning, I’m having a hard time updating SQL Server. I have the following situation: Table 1 ID Codigo Table 2 ID Nome And I have an excel file like this: Excel Codigo Nome I need to update the…
-
1
votes0
answers341
viewsSelect in Millions of SQL Server Records
Good morning, I have a database with more than 11 million records, when I make a select on top of the two tables to bring the records the query takes a lot, I wonder how I could improve these…
-
1
votes1
answer133
viewsHow to return a table from xml in sql server
My xml is similar to this: <Operacao Id="1"> <Contatos> <Contato Id="2013"> <Emails> <Email Id="40"/> <Email Id="41"/> </Emails> </Contato>…
-
1
votes1
answer156
viewsCompare group by sql server values
Something very unusual happened in my bank. Some records were entered more than once (7 to 13) to be exact. This occurred due to software error that has already been solved. Now I need to delete…
-
1
votes0
answers116
viewsHow to implement an exception using "IF AND ELSE" in a Sql Server query
I have a query that lists all databases, tables, highway, and dates. only that in the query it returns me an error in the conclusion pq within the field to which are stored all tables, there are…
sql-serverasked 7 years, 1 month ago Gladiador 345 -
1
votes2
answers61
viewsProcedure sql server 2012 + java
I want to structure an INSERT using JAVA in the same way that INSERT is structured in VB .NET. It follows how the code is in VB . NET: Const _spName = "dbo.MEJT_SP_CAD_PRODUTOS" Public Function…
-
1
votes1
answer83
viewsInsert data into db sql server
I’m having problems connecting my project to the database, I do not understand the reason, I’ve looked at several tutorials, use sql server 2017, I can access db in an application, but the site is…
-
1
votes2
answers230
viewsQuery returns "Invalid column name 'result'. " where 'result' is a column generated by select (SQL SERVER)
SELECT cte, (CONVERT(VARCHAR, manifesto) + ' ' + TIPO) as result FROM coleta WHERE result = '567 TRUCK SIDER'
-
1
votes1
answer596
viewsDoubt with calculation of the profit margin between values
I have an sql query where I am showing the cost value and sales value of the product, I would like to show the profit margin between cost and sales values, for the quantity of items sold select…
-
1
votes1
answer245
viewsjava error in connection with SQL Server
I’m trying to connect to a sql server database, but I’m not succeeding. Follows connection class and test method: public class ConexaoBanco { public static final String user = "sa"; public static…
-
1
votes2
answers380
viewsHow to filter records by date using SQL
I am using SQL Server and need to query in a table the most recent price record as the date. Of all the records, I need him to bring me only 1 and with the current date. How do I do this?…
-
1
votes4
answers2917
viewsFilter using only month and year on SQLSERVER
I need to mount a select, in which the filter is used only month and year in the parameters. This is the select I’m currently using, but I need the 'day' not to influence my search. SELECT…
-
1
votes1
answer365
viewsFill Linechart(Line chart) wpf with data from a sql server query
Hello, I’m having trouble finding a solution to fill my linechart with data from a query, my connection class is complete and working, but I don’t know how to apply on Chart, I don’t know how to…
-
1
votes1
answer50
viewsCRUD Needs the Procedure
My question is this:. When we create an ASP.NET MVC application that requires a basic CRUD. It is indispensable to use a database with procedures. Or I can do it another way ?…
-
1
votes0
answers102
viewsHelp with sql search and android studio
I made this layout <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"…
-
1
votes2
answers76
viewsProblem in consultation with Join
I’m having a little problem with the consultation to generate a report. I made a JOIN of the orders table (that will take the report) with the table of customers and products. Until then everything…
-
1
votes0
answers215
views8000 character limit in ASP Classic/SQL server
Dear friends, I’m trying to update a table in SQL Server 2008 R2, but the field only records 8000 characters. The column is set to 'text', but I have tried changing to 'varchar(max)' unsuccessfully.…
-
1
votes0
answers48
viewsI’m having trouble inserting data into a table with php
My form is like this: <form name="pedidooo" action="cadastrandoPedido.php" method="post" > <?php include './conex.php'; $query = ("SELECT * FROM conta"); $result =…
-
1
votes1
answer188
viewsData Flow Task: Processes but does not write to the Database
I am using SQL Server Integration Services (SSIS) with SQL Server Data Tools (graphical component for Visual Studio 2015). Within my processing package (SSIS) I have streams that, depending on the…
-
1
votes0
answers35
viewsSQL Server Base with encrypted columns
I have an SQL database in which I encrypted some columns following the steps of the following explanation: https://www.devmedia.com.br/criptografia-de-dados-no-sql-server/37027 I basically created…
-
1
votes1
answer79
viewsHow can I merge the rest of the data with the first query in SQL
Personal I have a query in SQL that returns the values not duplicated column: Nº Tel, and that has the Status equal to TEMPORARY MALFUNCTION SELECT DISTINCT [Nº Tel] FROM [export$] WHERE [Status] =…
-
1
votes1
answer212
viewsOptimize module 10 SQL Server
I have a database created by apróx. a decade, this same bank has several records and obviously, by being in production, can not be changed from day to night. The problem is: The products registered…
-
1
votes1
answer171
viewsHow to add a left 0 to a datetime
I need to be able to add a 0 to the left in the hours when sql only takes 3 digits or it is from midnight to 9 am so that the information is ordered! Because if not the information I have is in the…
-
1
votes1
answer884
viewsGoogle Charts with SQL Server
Hello, I’m trying to develop some graphics in a web application Asp.net MVC 5, regarding the development of the report, quiet, leaving with fixed information. But, how can I integrate the graph with…
-
1
votes1
answer775
viewsIs there a possibility to compare schema between different databases in SQL Server?
I have several different comics, and I need to compare their Schemas, but doing this manually can go unnoticed. For context I will use database of smaller proportion than work. Image here. As you…
-
1
votes1
answer94
viewsSql - Concatenate values if field is equal
I have the following select: SELECT c.codigo ,c.situacao ,c.fk_aluno FROM tb_cad AS c INNER JOIN tb_aluno AS a ON c.fk_aluno = a.id order by c.fk_aluno I need when c.fk_aluno is equal, agglutinate…
-
1
votes0
answers69
viewsError loading DLL into SQL Server
I received a DLL from a client, who will be encrypting 4 keys to be sent in database queries. I made the registration with sp_addextendedproc 'xp_definekey', 'c:\path\criptokey.dll'. But while…