Questions tagged as 'sql-server'

2
answers

How to copy the data of one table from one database into another database with an identical table?

Greetings to all, friends. I have the following problem: I just assumed the administration of an old system which manages 4 databases (different names, identical structure) but the only common table in structure and data is that of Users....
asked by 01.03.2017 / 19:23
1
answer

How to encrypt and decrypt data in SQL Server

How could I encrypt and decrypt data in a database sql-server ? I have a Users table, with different fields and I want to encrypt the password field. Note: In the following answer I am working with a database of Users, with their fields...
asked by 09.11.2016 / 13:24
1
answer

How to manipulate a column with a name used by querys in SQL?

I have a table in SQL server with the name default , but the problem is that SQL uses the word 'default' to do something else. Then I can not manipulate the default column of my table. In what way can I do it? I can not edit the name of the v...
asked by 28.11.2018 / 14:53
1
answer

How to convert a boolean to string in a Store procedure SQL

I have the following procedure (select) that gives me some information: SELECT id_accion, accion_tomada, CAST(fec_inicio AS VARCHAR) AS fecha_ini, CAST(fec_fin AS VARCHAR) AS fecha_fin, estatus FROM detalles WHERE id_downtime = @id_dt...
asked by 02.05.2018 / 22:44
1
answer

how can I save an insert in a txt

I have a problem I can not save a complete insert in a txt, I save it but it saves the parameters not the real values, this is my code if (!dao.success) throw new Exception(dao.message); //Leer metadatos: Tabla y Campos stri...
asked by 06.08.2018 / 17:17
1
answer

MS SQL Server android connection

I have the following code for a login, but when executing the application, it is dropped by the OnClickListener method (server, and users of the bdd omitted for obvious reasons) package com.ciclomapp.ciclomapp.ciclomapp; import android.annota...
asked by 02.10.2016 / 21:13
1
answer

Efficient Query Group by, Having - SQL Server

I have the following query : SELECT S.IdCliente ,S.NOMBRE ,S.JLI_SDESLINEA ,S.JCA_SDESCATEGORIA ,SUM(S.MONTO) AS MONTO ,COUNT(*) AS QTY ,S.DIA ,T.IDTERRITORIO ,T.VENDEDOR ,T.SUPERVISOR ,V.IDCLIENTE FROM...
asked by 10.08.2017 / 23:53
1
answer

IF nested in TRIGGER SQL

I must make a trigger that does not allow to alter tables that are registered within a specific table. For this, what I was thinking is to make an IF that asks if the name of the base, the schema and the name of the table are housed in that t...
asked by 03.08.2016 / 02:45
1
answer

do not repeat table results

I have the following query SELECT DISTINCT HPNESTANC.ADNINGRES AS ESTANCIA1 , HPNESTANC.HESFECING AS FECHA_INGRESO FROM HPNESTANC WHERE EXISTS (SELECT MAX( HPNESTANC.ADNINGRES), MAX(HPNESTANC.HESFECING) FROM HPNESTANC WHERE HPNDEFCA...
asked by 03.07.2018 / 22:38
2
answers

Iterative query with permissions

I have two tables jerarquia and permisos , where hierarchy has an ID, a ID_PADRE (pointing to the same table to a parent node) and a DESCRIPTION of the node itself. The permissions table has an ID_OPERATOR (id of the user that is lo...
asked by 04.08.2017 / 16:14