Questions tagged as 'sql'

4
answers

SQL Home Time (Years, months and days) [duplicate]

I need to create a function in SQL that returns employee's time, for example: years , months and days So far I've been able to bring the years and months , but I could not reach the day's logic yet, / p> DECLARE @DTINI DATE, @DTFI...
asked by 30.12.2015 / 12:58
1
answer

Error with sql Like

How do I extract all fields beginning with '1.' from the database? In my statement I used LIKE but it did not have any return, but if I remove the point it already returns something, but it returns fields that I do not want, eg 10.1; What's wron...
asked by 02.12.2015 / 11:02
1
answer

How do I create scheduled events in SQL Server, similar to MySQL event?

In MySQL I used this syntax to create a scheduled event: CREATE EVENT 'evento_LimparPaper' ON SCHEDULE EVERY 1 MONTH STARTS '2014-06-3 00:00:01' ON COMPLETION NOT PRESERVE ENABLE COMMENT '' DO BEGIN UPDATE 'tbl_Paper' SET capa='mudar'; END...
asked by 02.07.2014 / 21:06
1
answer

Simulate the same SQL in the Entity Framework with Linq and Lambda?

Having this data model I want to generate a SQL in the Entity Framework with < a href="http://msdn.microsoft.com/en-us/library/bb425822.aspx"> Linq and
asked by 03.07.2014 / 17:41
1
answer

How to insert into a database with special characters?

I am doing the following INSERT : $result = mysql_query("INSERT INTO tbl_livro VALUES (NULL, '$titulo', '$autor_livro')"); What happens is that there are authors who have names with special characters, for example: O'Reilly Media, In...
asked by 29.01.2015 / 12:08
1
answer

Get rows that are not logged in

I have a table with columns para and de where I enter different IDs in each one, however I need to get the ID of the user that sent the request to me, ie the ID that is not the same as the user logged in. SELECT 'username' FROM a...
asked by 01.02.2015 / 23:48
3
answers

List the months, per year in mysql

I'm trying to do the following in php and mysql : What is in parentheses is the number of results within each month. For this, I am saving in my database, in the tbl_noticias table the data field of type yyyy...
asked by 24.03.2014 / 13:11
3
answers

Do not fill field if it does not exist

I have a question about how to ask a question to the database. Suppose I have two tables with slightly different structures Table1 id tipoA data 0 A '21/12/14' Table2 id tipoB data 1 B...
asked by 16.06.2015 / 16:26
2
answers

Checking days remaining between current date and deadline for contact [duplicate]

Good afternoon folks, as per the code below, I can not check the remaining days between $ date and $ prazocontato. $consulta = mysql_query(" SELECT s.id_cliente, p.nome_servicos, s.data, s.prazocontato, s.email, s.vaifazerservicos...
asked by 25.07.2016 / 20:39
5
answers

How to get the total character size of an SQL column?

I want to get the total length of characters that a column supports, eg INT supports 10 characters. I tried to use DATALENGTH that does not return the number of characters , but the amount of bytes that the column occupies....
asked by 10.04.2014 / 20:39