Questions tagged as 'sql'

2
answers

SQL - How to Get Last Day of the Previous Month Dynamically in this Situation

Well, how do I get the last day of the previous month dynamically (associated with the current date); I have a column that is associated with the date in Milliseconds 'wo.CREATEDTIME' - Example of some dates in this format: > 152780...
asked by 11.07.2018 / 02:01
1
answer

How to return the table values using the SUM () function?

I have the following tables CREATE TABLE tbCliente ( ClienteID INT IDENTITY(1,1) PRIMARY KEY, ClienteNome VARCHAR(50), ClienteTelefone VARCHAR(15), ClienteDataCadastro DATE) CREATE TABLE tbPagamento ( PagamentoID INT IDENTITY(1,1) PRIM...
asked by 14.12.2018 / 00:55
3
answers

How do I store more than one value in an "SQL variable"?

I work with a system that has a very limited report builder. The reports are basically restricted to a SQL query. I need to present a query in a report that, in my query, the user is being informed by a multi-selection parameter, I will expl...
asked by 29.11.2018 / 01:04
2
answers

Using & in Oracle search

I have a question about the use of & in Oracle. See below my table. Whenreferringtothedescription'EasyBreezyEmailmkt&I',Oracleopensawindowforparameterpassing,asshownbelow. My question, how can I query with & without the b...
asked by 19.07.2017 / 20:38
1
answer

What is parameter sniffing?

I've heard of parameter sniffing. Something to do with SQL Server, stored procedures, and parameters. But what exactly is it?     
asked by 08.02.2014 / 19:43
3
answers

How to go through each row in the database compare and update a specific column?

I have a table named PRODUCT and I need to make a comparison between two columns, the column DATA_INICIAL AND DATA_FINAL , for each line covered, if the product does not agree enter the value 0 in the PROD_ATIVO column. Rule: If...
asked by 27.03.2017 / 20:53
3
answers

SQL - Bring only 1 year records back

I'm trying to make a SELECT that brings me only customers who have not bought for 1 year back without duplicating the client. Below the code I'm trying to do: SELECT DISTINCT p.ID, p.Nome_Fantasia, v.Data from Venda v inner join Cliente cl...
asked by 24.04.2018 / 16:08
1
answer

How to return the expected result in this query?

Good afternoon, guys. The case is as follows: I have a table with 2 blogs of category "automovel" and part of the title "Hackers" then whatever my query, can not return more than two results combining the "title" and "category" . Can you help me...
asked by 19.11.2016 / 15:26
1
answer

Select with LIKE with argument%

I'm trying to make a select, using LIKE and setting the argument%:    WHERE title LIKE '% computer%' finds all book titles with the word 'computer' anywhere in the book title. source: link However, when I run the direct comman...
asked by 14.08.2016 / 16:02
1
answer

How to traverse a SELECT rows in a STORED PROCEDURE in SQL Server?

Without using CURSOR and WHILE in SQL Server , what other ways would you be able to traverse the result lines of a SELECT to a STORED PROCEDURE ?     
asked by 13.02.2016 / 09:11