Questions tagged as 'sql'

1
answer

How to round off time?

I have the following function that treats a time that comes from the bank: SELECT f.chapa AS chapa, f.nome AS nome, f.secao AS cod_secao, f.nsecao AS desc_secao, c.codigo AS cod_funcao, c.nome AS desc_funcao,...
asked by 10.02.2017 / 14:47
1
answer

How to remove spaces leaving only one?

Considering a variable with a text in SQL Server . How can I remove 2 or more spaces within the text? In this case leaving only 1 space. For example: '1 tigre, 2 tigres, 3 tigres' Should result in: '1 tigre, 2 tigres, 3 tigres...
asked by 16.05.2017 / 15:47
2
answers

Entity Framework WITH (NOLOCK)

We can use the NOLOCK feature in SELECT , thus avoiding locks with INSERT SELECT COUNT(Descricao) FROM Produtos WITH (NOLOCK) Would there be any way to use WITH(NOLOCK) in the Entity Framework?     
asked by 22.02.2017 / 17:08
2
answers

How to sort the results of a ranking?

I'm developing a game, and in it I need to do a ranking according to the time it took the user to reach the end of the game. My question is, what kind of data should I use in my database to be able to organize when displaying the ranking?...
asked by 15.09.2015 / 19:05
1
answer

Identify if a string is uppercase in sql server!

I have a field in a table that must be filled in all lowercase, but the user being user has filled some lines in uppercase. I want to identify which records are in order to request correction. How can I test if my string is all uppercase?   ...
asked by 02.06.2017 / 19:24
2
answers

How to print the SQL statement being sent to the bank?

I would like to know how to write a SQL for control purposes of the statement being sent to the database: $sql = $pdo->query("SELECT * FROM imovel WEHRE CATEGORIA = 'APARTAMENTO'"); How to print the SQL statement being sent to the bank?...
asked by 03.10.2014 / 18:34
3
answers

Subtract date and display in YEARS, MONTHS and DAYS

DBMS: MySQL Problem: How do I return the subtract of the current date with a specific date and return the value in YEARS, MONTHS and DAYS in a query? Example: DADOS DataAdmissao dataAtual 2010-04-07 2014-06-27 (este dado não está...
asked by 27.06.2014 / 21:33
2
answers

Turn columns into rows

I have the following structure: link CREATE TABLE Viagem ( Idasemvolta int, Idacomvolta int ); INSERT INTO Viagem VALUES (64, 39) With the following select: select Idasemvolta, Idacomvolta from viagem This is not the complete st...
asked by 03.10.2018 / 15:47
1
answer

Number of columns influence performance?

When we model a database, can the number of columns interfere with performance? Ex: Tabela1 possui 2 campos, 1 int pk e 1 nvarchar(50) Tabela2 possui 50 campos, 1 int pk e 49 nvarchar(50) Select used for both tables, regardless o...
asked by 27.10.2015 / 13:01
3
answers

"Translate" MySQL query for SQL Server 2012

What is the SQL Server 2012 query that corresponds to the next MySQL query? REPLACE INTO schedule SET jobname = "sqldump" , last_exec_date = NOW()     
asked by 29.12.2016 / 05:51