Questions tagged as 'sql'

1
answer

Select columns with no specific name

I'm developing a C # application that consumes data from a spreadsheet, and at some point I need a query string that will feed a variable. For example: strComando1 = "SELECT TOP 2 ColunaGenerica1, ColunaGenerica2 FROM ["+ planilha +"]";...
asked by 09.02.2018 / 13:21
2
answers

PostgreSQL query with no data return

See the following SQL code: SELECT * FROM venda ve WHERE ve.datavenda <= DATE '28/08/2016' The bank has the following data: The above SQL query is not returning any results, why? can you help me? Thank you in advance!     
asked by 07.09.2016 / 02:07
3
answers

psql command at the prompt. (Postgresql Bank)

Good morning, I'm trying to make a script with .bat extension to do automatic update in the bank, except that in order to do this I need to know how to enter the password of my bank through command. I'm doing the following to access my ban...
asked by 16.02.2017 / 17:13
2
answers

How to remove mysql records for half an hour (or more) ago [closed]

I need to remove mysql records that have been made half a hour (or more) ago. That is, leave only the records of the last 30 minutes. This every time a certain php script runs. How do I?     
asked by 30.01.2017 / 02:37
4
answers

How to return date and time closer to the one informed by the user

I have a table with a list of places where a truck passed with the date / time of its entry and exit +----+------------------+-----------+---------------+ | ID | DATA E HORA | LOCAL | ENTRADA/SAIDA | +----+------------------+---------...
asked by 01.02.2017 / 02:42
2
answers

Removing part of a string - SQL Server

I have written the name of a file with extension (FILE.txt) in a database column. I need to show in a SELECT only the FILE instead of ARCHIVE.txt Does anyone know how to do it?     
asked by 05.01.2017 / 19:05
1
answer

Improve slow query performance in MS SQL SERVER

Are the indexes incorrect? I'm having a hard time optimizing a query. I had another question for a simpler case that resolved, but in that case I'm not getting a better result. The following query is taking 19 seconds: select top 12 c.cre...
asked by 09.01.2017 / 20:03
2
answers

NOT EXISTS in update?

I have the following SQL: insert into teste (id,nome) select 2,'João' from dual where not exists(select * from teste where nome = 'João') Would you like to do the same with update? Is there any way?     
asked by 18.06.2016 / 01:37
1
answer

Problem running eventhandler

I have a class, which is executed under a button, it makes two select in a bank. I am trying to do this with EventHandler , however, when running the system, it executes, but gives the error in the line: OnDataChange(info);...
asked by 05.06.2016 / 01:29
3
answers

Difference between dates in months with decimal return

Good morning! I am using the command below and the result returned is 6. In fact, observing the dates well, it has not closed exactly the 6 months, I think that through this function days are not being considered, and this is causing me a pro...
asked by 17.08.2018 / 16:03