Questions tagged as 'sql-server'

4
answers

SQL query to retrieve all records from last month but up to the current day

Good morning, I need to know a% change from last month's job records to job records made this month. For this I need to compare with the current day, for example. If today was 10/15/2015 I need to count how many tasks were opened between 0...
asked by 30.10.2015 / 12:28
1
answer

Is it possible to tell the size of the VARCHAR in a NamedParameter?

I'm working on a tuning of a SQL Server database. Through the query below, I can see how the bank ran some of my heaviest queries. SELECT TOP 30 deqt.TEXT AS Query, last_execution_time FROM sys.dm_exec_query_stats deqs C...
asked by 01.11.2017 / 13:14
1
answer

Why the OFF SET leaves SQL slower?

I have the following SQL, generated by Entity Framework 6. SELECT [Project1].[C1] AS [C1], [Project1].[ID] AS [ID], [Project1].[CAMPO1] AS [CAMPO1], [Project1].[CAMPO2] AS [CAMPO2], [Project1].[CAMPO3] AS [CAMPO3],...
asked by 17.11.2015 / 13:44
2
answers

SQL Server - Check duplicate data in two concurrent fields

DBMS: SQL Server 2014; Problem: I need to know which records are duplicated, so that the verification is done in two simultaneous fields, ie if the field "CPF" with the value '83971465842' and the field 'MAT' with the value ' 001 'exists, in...
asked by 25.06.2014 / 22:39
2
answers

Problem retrieving inserted id

I created a record with a 58 data. As I was creating, I was testing and the data was entering the DB, and every time an insert was made, I get the id of the last set / data group entered. But if I "refresh on the page" when I am go...
asked by 16.12.2014 / 18:12
2
answers

Show command executed when error occurs in SQL

Considering the following executed command BEGIN TRY -- Generate a divide-by-zero error. SELECT 1/0; END TRY BEGIN CATCH SELECT ERROR_NUMBER() AS ErrorNumber ,ERROR_SEVERITY() AS ErrorSeverity...
asked by 07.07.2016 / 19:22
0
answers

Working with two databases in Laravel [closed]

I'm creating an application that needs to connect to 2 different databases. A database I'm creating (MySQL) and a database I got ready that I have permission to query only (SQL Server). The purpose of the application is to query the data of the...
asked by 19.10.2015 / 12:08
0
answers

Permission problem when installing MediaWiki on Sql Server

I'm having problems trying to install MediaWiki using Sql Server. The following error occurs:    [SQLSTATE 42000] [Error Code 2760] [Microsoft] [SQL Server Native Client 11.0] [SQL Server] The specified schema name "dbo" does not exist or...
asked by 24.06.2014 / 19:42
3
answers

How to do a select within a condition?

How can I do to create a script in SQL where a SELECT runs, and according to the result of a column of this first, a certain condition of another table? example: select * from tabela as t SE t.saldo = 0 entao WHERE t2.outracondicao =...
asked by 14.09.2018 / 13:19
3
answers

How many days are left for a date [duplicate]

Does anyone have a query in sql server that returns how many days are missing for a date? I have the employee's date of admission, I need to know, how many days to complete 45 days, and how many days to complete 90 days.     
asked by 21.07.2017 / 19:53