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
answer1265
viewsCall stored Procedure in the Laravel using SQL Server with OUTPUT
I’m trying to call a stored file by Laravel 5.5 but I’m not getting it. I’m using SQL Server. Follow the stored Precedent: declare @CodigoRet int exec Generator 'LancaContaContabil', @Codigo =…
-
0
votes2
answers270
viewsHow do I compare values between two tables and send email if it has new value?
My system imports every day CSV files from several directories into a table called TB_ARQUIVO. In this file, it contains the name of the Hotel (HOTEL_NOME column) and four types of Channels...…
-
0
votes0
answers76
viewsTrigger no sql server management studio
I would like to create a Trigger in MSSMS (Sql Server) that, if I made an INSERT in table A, with the last record of table B, it would insert 10 more records in table B, and so on whenever I used…
-
0
votes1
answer124
viewsSQL Server vs Mongodb - Disk Size
Today I have a table in SQL Server very large and receives data all the time referring to some factory machine. This is causing a problem of large disk consumption, table size keeps increasing. If I…
-
0
votes1
answer88
viewsError running Add-Migration Setup
When executing the command Add-Migration Setup for the creation of the table in SQL Server in PM the message below occurs even if I reference the api project with Shared. The system even processes…
-
0
votes1
answer100
viewsSubtraction between two fields of the same value does not give zero-SQL Server
Someone could explain to me: I made a Join between two tables. Both bring the same value in their fields. And when subtracting one value minus the other, it does not give zero. As this is possible?…
-
0
votes0
answers45
viewsValidate strings with many zeros
I have to perform a validation on a Trigger on sql server the rule is: if cnpj is != 0 and does not exist in another record continue; however cnpj can come with 0 or 000 or 0000000 or 00, which…
sql-serverasked 7 years, 1 month ago João Rafael Colombo 121 -
0
votes2
answers917
viewsHow to reduce the running time of a query in SQL server?
I have a query that when it runs it’s taking a little while to bring results. And I don’t know where to start to improve this query. If anyone can help me I’ll be grateful. The query copies record…
-
0
votes2
answers608
viewsSelect columns dynamically with Linq
I have an action in an API that should return a model, but the fields that should be returned are informed in the request. I can do a query with the System.Linq.Dynamic.Core package, but the…
-
0
votes1
answer20
viewsHow to add another column to my query found in another table
SELECT DEPARTMENT_ID ,(SELECT DEPARTMENT_NAME FROM HR.DEPARTMENTS) AS 'Nome do Departamento' ,MIN(SALARY) AS 'salario minimo' ,MAX(SALARY) AS 'salario maximo' ,CAST(AVG(SALARY) AS NUMERIC(8,2)) AS…
sql-serverasked 6 years, 1 month ago Bruno Bacelar 55 -
0
votes1
answer4491
viewsSQL Server - How to create a new table using a select from another table (Both in the same Database)
I made an sql script by joining some tables in SQL Server and will have the result in some fields, but I would like to create a new table and copy everything that Filtrei with select into it...…
sql-serverasked 7 years, 1 month ago Master JR 1,853 -
0
votes1
answer134
viewsSelect from column B if field selected in column A is null
In a consultation SQL was trying to work out a way to select a value from another column B if the selected column value To is null. I first made the following query: SELECT…
-
0
votes2
answers1789
viewsDivision in the sqlserver
I am using SQL Server 2008, I would like to split 50/100 for example and return me 0.05. However it returns me 0, follows what I tried to do:…
-
0
votes2
answers113
viewsDoubt integration test
I think it’s a somewhat conceptual question about the subject, but come on: I have an example method that validates a user checking if it exists in the database, thus: public bool…
-
0
votes1
answer919
viewsDate handling problem in an ACCESS/VBA application with SQL Server database
I needed to migrate the database of an application made in vba using access. The database was native to access and passed to SQL Server. In access, as everything is native everything worked…
-
0
votes0
answers44
viewsSending values to BD makes the application too slow
I created a program in java to capture the movement of a sensor and then send the data to a database, so that later the movement is accessed by another machine in real time (or almost) elsewhere.…
-
0
votes2
answers462
viewsBring today’s date records up to 1 month ago SQLSERVER
How do I get today’s date records up to 1 month ago on SQLSERVER? I know that for example, with 7 days, use GETDATE()-7. But and for 1 month, as would be?
-
0
votes2
answers54
viewsDecreasing the value of two fields of a table and sorting according to the result
I have the field "killed" and "died" in the table, I need to make the order of the results come as the decrease of these two values, Example: My query is like this: $woes = DB::table('woeplayerrank…
-
0
votes1
answer67
viewsRelationship in tables in the database
I have a table in the database called Veiculo and it has the following fields: placa, renavam, marca, cor and categoria. To the placa and renavam is all right, since the data are unique. My question…
-
0
votes1
answer988
viewsError: There are no Primary or candidate Keys in the referenced table
I’m trying to relate these two tables IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Periodo') AND type in (N'U')) DROP TABLE Periodo GO CREATE TABLE Periodo( Numero tinyint NOT…
-
0
votes1
answer35
viewsHow to extract the SQL Server log file from the server?
I have an SQL Server and I need to send the Log file to one of our Clients, but this query has 24 Gigabyte, doubt: How to extract this logo file in csv format ?
sql-serverasked 6 years ago hard123 2,329 -
0
votes2
answers597
viewsJoin column data online - SQL Server
I have the following situation: Usuario_A telefone1 Usuario_A telefone2 Usuario_A telefone3 How can I make so that when I make a select, I have the following output:…
-
0
votes0
answers1609
viewsSQL Server Driver in WAMP
I’m trying to install the SQL Server driver for php 5.5.12 (x64) but I haven’t been able to yet I downloaded the dll’s from website official, and added in php.ini They appeared in the list of PHP…
-
0
votes0
answers268
viewsHow to import record from only one CSV column within a Sql server column?
I have a csv file with multiple columns "ID,NOME_RUA,DATE" and I want to enter the record of a column "NOME_RUA" which is inside the csv file in my sql server table called "DATA". My "DATA" table in…
sql-serverasked 7 years ago Gladiador 345 -
0
votes1
answer331
viewsTake last table value from bank and show in Jtextfield
I have a program here at the factory that, every 1 minute, an equipment connected to a supervisory launches a direct value in a table in the database (SQL Server). I wonder how do I always take the…
-
0
votes1
answer516
viewsReplace SQL SERVER between columns
How to replace between columns in SQL SERVER. For example, given the table below: COLUNA_A | COLUNA B | COLUNA_C A 123 casa I tried to run the query: SELECT REPLACE(COLUNA_C, COLUNA_A, COLUNA_B )…
-
0
votes1
answer152
viewsGroup By SQL Server function
I’m a beginner in SQL Server, would like a help to understand the function Group By in a simple way. Both your concept and the way to use... for those who can help me thank you already!…
-
0
votes2
answers271
viewsUPDATE with two conditions
I’d like to make a UPDATE where I have two conditions; I would like to join the two in one, if not one is the other. FIRST : UPDATE RLT005 SET CtrDatBaixa = '2018-12-15 00:00:00' WHERE CtrDatBaixa…
-
0
votes0
answers106
viewsRun order of searched CASE expression
The CASE WHEN has two forms of functionally, with simple and researched expressions: The expression SIMPLE CASE compares an expression with a set of simple expressions to determine the result. The…
-
0
votes1
answer1231
viewsHow to increase the Grid View Result font in SQL Server Management Studio 17.9.1?
I want to increase the source of Grid View Result because it gets too small in a full hd notebook of 15.6. I’ve been to the Fonts and Colors options but I can’t find the option:…
-
0
votes1
answer407
viewsSet a condition in order by mysql
I am having doubts about a subject related to order by. In my table you have the following information: ID | ORDEM | NOME 1 | 0 | NOME01 2 | 2 | NOME02 3 | 1 | NOME03 I want to give a select where…
-
0
votes1
answer62
viewsStored Procedures parameters
I have a question and I wanted to ask for your help. Next: I have a proc and I want when I don’t pass a parameter it returns to me null and when this happens bring the date of the day -1 and time…
-
0
votes1
answer278
viewsError adding ON DELETE CASCADE two Foreign Keys from the same table
I am deploying a table to save the messages, in this table I have source users (sender) and destination user(recipient) from the same table: user. When trying to add the constraints to the message…
-
0
votes1
answer84
viewsSQL command to add up the vacancies occupied on a specific day of a parking lot
Talk guys, I’m having a little trouble finishing a college job and it would be really helpful if you guys would help me with a little VIEW. Here are the fields of the parking table: CREATE TABLE…
-
0
votes1
answer711
viewsCheck the frequency of records in the table
I have a table where are saved all services performed in several cars. The key is the car plate. A car can have more than one service performed per day. And for each service performed a new service…
-
0
votes0
answers308
viewsWhat better way to work/store files in Base64 C# + Sqlserver
I am consuming an external API, and in return I have a PDF file in format base64, would like to know how best to work/store this kind of data in the database SqlServer + C#. My question is: 1 - I…
-
0
votes0
answers184
viewsMonth and day reversed when saving to database
I’m using datepicker of jqueryUI to choose the date in a calendar, the problem is, if I choose 04/12/2017 is saved at the bank 12/04/2017. datepicker: $('#schedulingCalendar').datepicker({…
-
0
votes1
answer239
viewsSyntax error near limit
Can someone help me? I have the following query: select coluna1, coluna2, coluna3 from tabela where coluna2 > 0 order by coluna3 desc limit 10 And when I execute the following error appears: Msg…
-
0
votes1
answer315
viewsTimeout Android Connection and SQL Server using JDBC/JTDS
I would like to limit a time for the connection. Every time she doesn’t find the Host to connect, she keeps trying and it takes. Here’s the code: @SuppressLint("NewApi") public Connection CONN() {…
-
0
votes1
answer74
viewsError in running Function SQL Server
I have a database proof today and I’m practicing functions with old exercises only I’m getting an error when I run the function. tables set language brazilian; CREATE TABLE pedido ( nr_pedido…
-
0
votes0
answers28
viewsRestore database in sql server 2008 R2
I have a file . Bak and while trying to restore I am using the following command: use [master] RESTORE DATABASE Teste FROM DISK='C:\Teste.BAK' But sql returns me the following message: Msg 3241,…
-
0
votes1
answer89
viewsHow to remove the special character that forms inside a String in SQL?
I am using the excerpt below in my code, but when inserting > inside a String, it returns the result as > ;, the same is converting to HTML entity, as I can use '>', without problems?…
-
0
votes2
answers259
viewsInsert Select Sql Server
Connection and Historico_ligacao I have a script which copies all data from the table Ligacao for Historico_ligacao. When I compare the data between the theban, the table historico_ligacao is…
-
0
votes2
answers52
viewsSQL/LINQ vs. Data to feed
I’m trying to generate a query in VS2015 with Linq (here, I exemplified in SQL, to speed up my tests right in the database) that returns the data grouped and counted from 6 months ago, it happens…
-
0
votes2
answers322
viewsProcedure delete Join between tables
Good afternoon, I have the following Tb environment.Client where a client has N processes in Tb.Process, N movements in Tb.Progress and N attachments in Tb.Annex. I need to mount an sql statement…
-
0
votes1
answer73
viewsRepeating data from a JOBJECT
I managed to make my JArray return a list, in this list contains 03 Ids, but the way the system was done, they made a way to return only the first Array. Follows the code of what is returning to the…
-
0
votes0
answers25
viewsStrange behavior with group concealment
I have a strange situation in my report. It has two groups of lines where the first level is hidden and expands when selected in the second, but in the report view it is not reduced. He’s showing…
-
0
votes0
answers534
viewsError - Trying to get Property of non-object - Laravel
I moved my production bank ,to site the production base returns the objects already my local database appears this message My projectController /** * Lista todos os projetos ativos * @access public…
-
0
votes1
answer42
viewsHow to delete the records of several tables by scoring the ones that should not be deleted in sql server 2014?
I would like to delete all the records from the tables of my database, but some tables cannot be deleted, here in my case for example I have an average of 20 tables of which 6 cannot be erased the…
-
0
votes0
answers45
viewsConnectionstrings Visual Studio Code
I’m using Visual Studio Code with the mssql extension on linux, I need to nail Connection Strings from a database I’ve already created, but I’m not getting.