Questions tagged as 'sql-server'

1
answer

Generate Excel in SQL SERVER [closed]

Good afternoon. I need to generate an excel file by SQL SERVER. And I need to specify the data type of the cells in that file. For example, in value cells, set the data type to "R $" for example. In cell with percentage, already set cell d...
asked by 17.10.2016 / 22:20
1
answer

PHP7 does not work with SQL Server 2014

I have a project running on Xampp with PHP 5.6 and SQL Server 2014 Express. I am trying to migrate the project to PHP 7.1.0 but it is giving error as picture below. I copied the dlls to the PHP ext folder which is in c: \ php7 \ ext. Th...
asked by 13.12.2016 / 17:12
1
answer

Check if date is between a period

In my table, I have two columns, DT_INICIO and DT_FIM , it would be an Absence table. Let's say that an employee is absent in DT_INICIO From (25/03/2016) to DT_FIM (3/27/2016), I need to make an appointment on 03/26...
asked by 31.03.2016 / 20:14
2
answers

Convert hours "hh: mm: ss" to minutes in int format

I have the following function that calculates the 01:00 hours, returns 60 minutes.  but the sql column stores in time (0) 01:00:00 format, What about the error in my function, I do not know how to increment the code to calcu...
asked by 28.03.2016 / 05:28
1
answer

How to do INSERT on three tables with Stored Procedure?

I need to perform an insert in three related tables in the same query. I have the following scenario: Cidade, Estado e Pais How can I build a stored procedure on Sql Server for this?     
asked by 17.02.2016 / 02:36
2
answers

Function with return using 'case when'

I have a function that returns me the status of a request (in the database it's int) that only has two possible values, 0 (inactive), 1 (active). I was trying to increment it with 'case when' in case the result is 0 it returns 'Inactive Request'...
asked by 04.01.2016 / 13:57
2
answers

Replace NULL with string

In a datetime field, when the value is NULL should only return - , I tried the IFNULL function SELECT ISNULL(data, '-') as data FROM tabela but I get the error Microsoft OLE DB Provider for SQL Server error '80040e07'...
asked by 16.05.2016 / 17:18
2
answers

Increment a number in a SQL query

I have the query that returns me the results. I would like to add an incremental number to show the records from 1 to the end as if it were a new column. select *, sum(valor) as ValorSoma, count(pedido) as QtdPedido from tb_vendas where idvend...
asked by 12.04.2016 / 21:48
1
answer

Query Result with SET STATISTICS

I wanted to know if I could get the "SET STATISTICS TIME ON" result. For example, the result of my query gave 1139ms. Can I get this result and manipulate it? Convert to seconds, minutes, write to a table ...     
asked by 17.03.2016 / 14:41
2
answers

If an int variable does not receive anything from the select it is zero or not

Let's say I have this block: declare @teste int declare teste_cur cursor for select campo1 from tabela ..... while @@fetch_status = 0 begin set @teste = 0 select @teste = campo1 from tabela where campo2 = condicao2 end ..... If the sele...
asked by 25.04.2017 / 13:18