Questions tagged as 'sql-server'

1
answer

How to nest independent 'select'?

I have the following table with information: What I need to show is this: I try with this code, but I duplicate the data: SELECT * FROM (SELECT Codigo AS LYC FROM Requerimi...
asked by 10.08.2018 / 00:05
1
answer

Commit tran in SQL

I have doubts that my SP is correct since I do not know if it should be used only once begin try and those instructions, apart it returns a 1 but does not do update : ALTER PROCEDURE [dbo].[SP_EliminarVariableFormula] @IdVaria...
asked by 21.05.2018 / 21:14
2
answers

How do I assign the select permission to a role in SQL SERVER?

I have the following activity and my code marks me wrong, can anyone tell me what I did wrong? --8.-Asignar el permiso Select a este rol grant select on database Prueba to role 'GranSelectRole'; Mark me an error in the "to" saying this:...
asked by 20.09.2018 / 05:57
4
answers

Problem when relating 4 tables with left join

I have a problem with SQL. I want to make the list of 4 tables (user, appuserFuncitonRelation, organizations, GroupCommerce) where the organization is related to groupCOmmerce and appuserFunctionRelation is related to both and the other has the...
asked by 27.03.2018 / 14:23
3
answers

Count rows in with a SQL Server subquery

I have the following query : SELECT DISTINCT NoEconomico ,count(NoEconomico) AS Totales FROM prm_FEMSA_IndicadoresTelemetria WHERE RPMEventos <> 0 AND AccountId = 9159 AND FechaInicio BETWEEN '2016-11-27' AND '...
asked by 22.03.2017 / 19:32
1
answer

Use cast for a filter on sql server

select (select NOMCLI from CARROS where cast(IDCLI as int) = idreg1) as NOMCLI, fecha from replog where movimiento = 'ALT' and TABLA = 'CARROS' and usuario = 'sa' I have an example here where idcli is integer: 327 and idreg1 i...
asked by 28.12.2016 / 21:07
2
answers

Warnin of sqlsrv_fetch_array () expects parameter 1 to be resource

I'm going to the point, I'm doing a search engine and when I put certain names or data, the results are shown, the problem is with some others where nothing is shown and it shows me the following warning    Warning: sqlsrv_fetch_array () expe...
asked by 13.09.2016 / 22:12
1
answer

Separate a column in several SQL Server

Does anyone know how to divide a field into several columns? I have an sp, which gives me the following information. I would like to divide the Week field into several columns SemanaAño Semana FechaInicio FechaFin R...
asked by 16.02.2017 / 17:17
2
answers

How to use several "IF" Conditionals in a Store Procedure in SQL Server

I would like to know how I can use several IFs in a Store procedure in SQL Server, How would Syntax be? Here I have an example of one, but this has only one If and one Else and within that ELSE there are two others, but I need to do more and it...
asked by 16.11.2018 / 17:36
1
answer

Load data in a text box from sql, when changing a combo box or a DataTimePicker in C #, Visual Studio MVC

making an application that records the daily information of what was done on a farm during the day. The screen is like this: In which the intention is that when changing a combo box or the datetimePicker date data is loaded from sql. I...
asked by 27.09.2018 / 19:53