Questions tagged as 'sql-server'

3
answers

How to empty my database from SQL Server [closed]

I would like to know how to empty my database, from SQL Server.     
asked by 29.05.2018 / 15:34
1
answer

How to call a stored procedure inside another

As I can solve this problem, I am trying to call a stored procedure inside another, this is the code that I have done so far, in the first image the stored procedure works (SP_SELECTINVENTARIO) in the second is the problem that I have , how can...
asked by 17.11.2017 / 19:15
1
answer

Execute AND statement dependent on a value of a variable

In a stored procedure I want to add an AND statement to the query depending on the value of a variable. DECLARE @name as varchar(50) SET @name = '' SELECT * FROM Tabla T WHERE T.campo = 'valor' Here I would like to add an AND statement to t...
asked by 18.12.2017 / 19:25
2
answers

SubConsulta separates me sql sever data

I have my query: select (select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 1 )as uno, (select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 2 )as dos, (select SUM(cco.Valor) from Temp t where t.cod = cc...
asked by 03.11.2017 / 15:05
2
answers

SQL Server, inner joins

I have a question with an SQL server query. I explain: What I would like to know is if there is the possibility of conditioning a search according to a field. I would like something like this: SELECT * FROM prestamos pre INNER JOIN poliz...
asked by 09.11.2017 / 18:27
2
answers

How can I do a Select and an Update in the same query?

I have 2 tables: Users [Id, UserType, Email, Password] Clients [Id, TypeUser, Email, Password, UltimaSesion] I have created a login query through the Email and password looking in both tables to know if it is a User of the company or a...
asked by 18.08.2017 / 02:43
3
answers

Why does ExecuteNonQuery () give me the following error?

Good will put my code here and have if someone can tell me what error I have here because I can not see it public List<EntidadProducto> listarProductosCD(SqlConnection conexion, int ID, String nombre, decimal precio) { List&l...
asked by 23.10.2017 / 00:32
3
answers

Add Cast in SQL SERVER

Hello friends I want to make a sum of a series of elements that "cast" to decimal , this is what I am trying to do. But he says    Incorrect syntax near 'sum'. select sum( SELECT CAST(em.sueldoDiario AS DECIMAL(18, 4)) ) from sysCPPues...
asked by 19.10.2018 / 18:03
2
answers

Validate duplicate records (SQL SEREVER)

Very good day to all, I hope you can help me with this doubt in sql server, I have a table called PriceList with the following fields List_ID, Customer_ID, Product_ID, PriceA, PriceB which is related to my Customer and Product table. At the t...
asked by 18.10.2018 / 17:29
2
answers

Consecutive to INSERT

I have this query INSERT INTO [SI_Consecutivo] (SI_Num_Inventario, SI_Nombre, SI_Fecha_Creacion, SI_Estado, SI_Almacen, SI_Num_Conteo) VALUES (1, 'uno', GETDATE(), 0,'cdis', 1 + FLOOR(RAND() * 1 )) I execute it with a button in javascrip...
asked by 22.06.2017 / 22:04