Questions tagged as 'sql-server'

2
answers

Structure correct for WITH in SQL Server

I have the following query: ;WITH TABLA1 AS ( SELECT COUNT(*) AS TOTAL_EMPLEADOS, TERRITORIO FROM AR_EMPLEADOS WHERE ANIO = 2018 AND TERRITORIO = 'A' GROUP BY TERRITORIO ) ;WITH TABLA2 AS ( SELECT COUNT(*) AS TOTAL_PRODUCTOS, TERRITORIO FROM...
asked by 28.08.2018 / 23:50
1
answer

Insert data from EXCEL to a table in SQL SERVER

I have a sheet in Excel 2016 that contains several columns with information about my clients; the file path is "D: \ Clients.xlsx". Then I have a table "tb_clients" in the Database "bd_comercial" (SQL Server 2008 R2) with the same names, orde...
asked by 21.05.2018 / 00:00
1
answer

Error when making queries with two databases: Can not resolve the collation conflict

How can I fix the error:    Can not resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_CP850_CI_AS" in the equal to operation. Query: SELECT T3.ItemCode,T3.ItemName, sum(Convert(int,A.VPiezas)...
asked by 02.07.2018 / 19:51
2
answers

How to merge multiple records into one using SQL SERVER?

I need this table: Be this: (edit it as an image using paint to show as an example) The data will always have the same 'serverName', DATE and TIME in common     
asked by 04.10.2018 / 18:48
1
answer

Problem calling procedure stored from Java

I have a problem trying to access a specific procedure stored in SQL Server from Java . The stored procedure receives a XML as a parameter, and returns another. An example of a call is the following: DECLARE @xml AS NVARCHAR(2000) DECLARE...
asked by 04.10.2018 / 11:45
1
answer

Error with SQL server Compound keys

this is the script for the first table CREATE TABLE [dbo].[eva_cat_metodologias] ( [IdMetodologia] SMALLINT IDENTITY (1, 1) NOT NULL PRIMARY KEY, [DesMetodologia] VARCHAR (200) NULL, [Clave] VARCHAR (50) NU...
asked by 03.06.2018 / 04:28
1
answer

Error Column name does not exist in SQL Server

I'm doing a query whose purpose is to put a label called Match and then filter that Match with WHERE , but it generates an error "Column name does not exist". My script is as follows: SELECT [Contra], [Schedule], SUM(CA...
asked by 24.05.2018 / 17:27
1
answer

Assign view to SQL Server User

Hello friends, I need you to help me with a problem I have. I have 2 databases (b1, b2) where from b2 I created a view (sales) that comes out of b1, which works correctly; I need to create a user that can access that view and nothing else....
asked by 18.04.2018 / 17:18
1
answer

Generate .TXT file with Stored Procedure

I have the following SP and I want the results saved in a .TXT file for   I also have a JOB which executes the Stored Procedure, which I configured   from the SQL Server Management Studio. This is an example of how a result of a query is sent...
asked by 09.01.2018 / 21:39
1
answer

Query to count different (MSSQL Server 2005 Express)

I have the following table: I need a number of different offices in each department: I made the following query, but it is not what the statement asks: SELECT depto_no, count(*) FROM empleado GROUP BY depto_no The issue is that...
asked by 20.11.2017 / 15:12