Questions tagged [sql-server]

Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all Microsoft SQL Server editions including Compact, Express, Azure, Fast-track, APS (formerly PDW) and Azure SQL DW. Do not use this tag for other types of DBMS (MySQL, PostgreSQL, Oracle, etc.). Do not use this tag for issues on software and mobile development, unless it is directly related to the database.

Filter by
Sorted by
Tagged with
0 votes
0 answers
57 views

Not able to insert excel values into MS SQL DB

I want to build a dynamic select query for an insert statement. I have the below table created in MS SQL with 200 columns. If the input Excel file has 10 columns then insertion will start column1 to ...
0 votes
0 answers
9 views

MsSQL stored procedure syntax error when using TestContainers in Spring Boot integration test

I'd really appreciate some help with MS-SQL server stored procedure syntax. I am trying to integration test a Java Spring Boot application using MSSQL TestContainers with R2DBC connection: mcr....
-2 votes
1 answer
34 views

SQL join 3 databases [closed]

I am right joining a table "FinalData" at last which should bring all the values of the right joining table and the matching values of the inner join tables but as the inner join values are ...
0 votes
0 answers
8 views

sum of cpu cost present in every node in the actual query plan vs, STATISTICS TIME ON, both have big difference number

Why does the sum of CPU times from individual nodes in my query's execution plan (15 seconds) differ significantly from the total execution time reported by SET STATISTICS TIME ON (2 seconds)? The ...
0 votes
0 answers
11 views

SQL Stored Procedure adding values to table run successful, but no result show in the table

I have created a stored procedure in SQL Server to add new student record to Student table. I have grant permission to one of the roles I created that is "DBAdmins". I have also login as &...
-3 votes
0 answers
35 views

Split week number between two dates [closed]

I am using SQL Server 2019. I want to calculate the week number between two dates. E.g. StatDate = 2024-01-01 EndDate = 2024-01-31 Expected output: StatDate EndDate WeekNo 2024-01-01 2024-01-07 1 ...
1 vote
0 answers
7 views

How to read / understand the context of query_abort extended events trace with SQL CallStackResolver?

So we've decided to test and perhaps implement the new "query_abort" extended events trace on all our database servers to learn more about our timeout queries. Currently, we use the "...
0 votes
0 answers
151 views

Remove Null Value in Multiple Dynamic Pivot Result

I've implemented dynamic multiple pivots for my table successfully. However, I'm encountering an issue with numerous NULL values in the result. Here's what my current result looks like: And here's ...
0 votes
3 answers
10k views

SSIS loading data error

I have a CSV file which contains this data: EmployeeCode,EmployeeName,EmployeeSalary,Date 101,raju,1000,2/2/2003 102,krish,100,3/4/2005 103,rishbh,320,12/9/2007 104,rani,4690,12/8/2008 105,olesia,...
25 votes
14 answers
152k views

ModuleNotFoundError: No module named 'pyodbc' when importing pyodbc into py script

I've written a short python script which tries to import the pyodbc extension package so I can access my SQL table. import pyodbc as pyodbc cnxn = pyodbc.connect('Driver={SQL Server};' ...
0 votes
0 answers
23 views

Can't restore SQL Server database [migrated]

I have a database that is called EIT-A02 restore and now I need to restore an additional database called EIT-A01, and when I try to restore it I get an error: The file 'C:\Program Files\Microsoft SQL ...
0 votes
0 answers
20 views

Using ADF to copy tables with hierarchy columns from one SQL Server to another

I have two tables on same schema crm, contacts and contactplus tables. The PK ContactID in contacts table references two FKs in contactplus: ContactID and childContactID columns which have a parent to ...
0 votes
0 answers
26 views

SQL Server database size is 10GB but tables are only around 450MB, what is occupying the rest and how can I reduce it?

I have a SQL Server database that has reached the 10 GB limit. When I do use EXEC sp_spaceused, I get reserved data index_size unused 10483208 KB 10352336 KB 90264 KB 40608 KB However when I do ...
0 votes
0 answers
19 views

Disallow user from querying database structure

How can I use SQL Server 2019 Developer edition's permissions to deny the curerntly logged in user from selecting data from the sys.objects, sys.tables, sys.columns, etc. system views, as well as the ...
0 votes
0 answers
36 views

Same query, same data - but much longer execution time and more reads in another server

I have a query that includes an inner join between 2 tables. When I use SET STATISTICS to get some information, I can see that the order of execution and reads is much different from one server to ...
0 votes
1 answer
48 views

Comparing and updating changes - SQL

I have 2 tables: latest and history. History will have all the rows loaded before and latest will have latest data in it. I want to come up with a consolidated table based on load_date and the table ...
10 votes
4 answers
45k views

An exception occurred while iterating over the results of a query for context type. The connection is closed

I'm getting the following error during a LINQ query running An exception occurred while iterating over the results of a query for context type. The connection is closed It's curious that this ...
-1 votes
0 answers
20 views

A transport-level error has occurred when receiving results from the server. provider: Shared Memory Provider, error: 0 - Ha terminado la canalización

I am using the following command because I want to import an Excel table to SQL IF OBJECT_ID('TEMPDB..##NOMBRE_TEMPORAL1') > 0 BEGIN DROP TABLE ##NOMBRE_TEMPORAL1 END SELECT * INTO ##...
0 votes
0 answers
17 views

SQL Server : consistent data encryption/masking while read

I would like to check with you regarding dynamic data encryption/masking when reading from a SQL Server database. To elaborate further, the data elements should be encrypted/masked when a set of users ...
-2 votes
0 answers
11 views

Print and Generate report for similarity text checker in vb.net

i already successful design and develop a text similarity checker in vb.net, but i don't know to generate the report where it print and highlight the text that have similarity between the input text ...
461 votes
28 answers
498k views

Conversion of a datetime2 data type to a datetime data type results out-of-range value

I've got a datatable with 5 columns, where a row is being filled with data then saved to the database via a transaction. While saving, an error is returned: The conversion of a datetime2 data type ...
7 votes
6 answers
27k views

UPSERT in SSIS

I am writing an SSIS package to run on SQL Server 2008. How do you do an UPSERT in SSIS? IF KEY NOT EXISTS INSERT ELSE IF DATA CHANGED UPDATE ENDIF ENDIF
-2 votes
0 answers
26 views

Avoid Putting Data in a Group By SQL

I am working on converting values to overpunch by joining an overpunch table to a purchases table, but for a report that sums up the purchases I am having trouble avoiding putting overpunch in the ...
12 votes
10 answers
73k views

How do I fix an error connecting to SQL Server: SSL Provider, error: 0 - The message received was unexpected or badly formatted

When connecting from my local dev box using Visual Studio 2012 (or 2013) against a SQL Server 2008R2 SP1, I get this message: A connection was successfully established with the server, but then an ...
-1 votes
0 answers
33 views

Get a value extracted from JSON_VALUE of single row and select the same for all the rows in a T-SQL Select statement

I am preparing a source view for my SQL Server to Dynamodb migration. SELECT TOP (1000) [Id], [AggregateId], [eventType], CAST(DECOMPRESS (CompressedJson) AS NVARCHAR(MAX)) ...
3 votes
0 answers
56 views

How often do you need to re-create the connection to SQL Server?

I did an experiment with the speed of writing to the database. I have several tables where logs are stored. I took 1 million logs and sent them in batches of 750 records into the database, while ...
-2 votes
1 answer
29 views

Jmeter Response : message:java.sql.SQLException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'

I am trying to initiate a connection to SQL Server using Jmeter, but I got this error: Response message: java.sql.SQLException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc....
-1 votes
1 answer
38 views

Cannot connect to SQL Server running in docker from app running in docker

I trying to run an ASP.NET Core app using SQL Server from docker. The app was created in VS 2022 with a target of .NET 8. I created docker image with this docker_compose: version: '3.9' services: # ...
0 votes
0 answers
52 views

ODBC Connection to existing SQL Server from new laptop in different domain

I'm trying to connect via ODBC to our existing database server, which is in a different AD domain than my laptop. Server is setup with Windows authentication. I can connect using SSMS. To do this I ...
0 votes
3 answers
10k views

SQL Server : how to cancel a query which is running?

I am testing some joins and I queried some large tables. I couldn't stop the query and I just closed the window. Upon closing I was being asked would you like to close the query, to which I said yes. ...
-1 votes
0 answers
71 views

How can I directly connect to SQL Server or Oracle using TMS WEB Core in Delphi? [closed]

As per the TMS WEB Core documentation, it seems like the primary way to access a database is through the corresponding REST API (XData) or Embarcadero's RAD Server. However, I find this approach ...
26 votes
5 answers
43k views

Error when installing Microsoft Sql Server 2019, cannot find the microsoft OLE DB Driver

Error given I am having trouble installing Microsoft SQL server 19 Express (I tired dev aswell, it does the same thing). It keeps giving me the error: Error Description: An installation package for ...
0 votes
1 answer
60 views

Turns rows into columns

I am using SQL Server 2012 and I am trying to "pivot" rows to columns per key. Maximum rows per set is 4. I have prepared a sample code in order to describe it better DECLARE @resu TABLE ...
0 votes
1 answer
35 views

IN SQL how to retrieve XML column data based on element

I have the XML inside one of the table columns, here I need to find rows based on 'DESCRIPTION' which is present in the table. Sample XML column value <Activity> <text value="ID:HELLO, ...
1 vote
3 answers
14k views

The version of the report server database is either in a format that is not valid, or it cannot be read

I had an SQL Server 2012 database instance installed on server A. I then installed SSRS 2016 only (not the the complete SQL Server 2016) on server B but pointed the SSRS instance to host its ...
-1 votes
3 answers
1k views

SQL Server Developer Edition 2014 installation failed

I have downloaded the SQL Server Developer Edition 2014 "en_sql_server_2014_developer_edition_with_service_pack_1_x64_dvd_6668542.iso" and extracted the iso file using Power iso. After clicking Setup ...
0 votes
0 answers
27 views

Can't connect to AWS SQL Server from local machine using node

I have created a AWS RDS SQL Server database. I can access the same from SSMS. However, the same fails if I try to connect using Node JS. Here is a snippet of the code. const sql = require("mssql&...
1 vote
2 answers
322 views

SqlGeography.STGeomFromText throw exception when creating Polygon

During creating Polygon it throws execution. I am using library Microsoft.SqlServer.Types latest version 160. polyText = "POLYGON (( 45.3972179 8.8406638000000157, 45.4215054 8.9151509000000715, ...
-1 votes
0 answers
34 views

SQL Server Replication(Log Reader Agent error) [closed]

I tried setting up a transactional replication in SQL Server but I keep getting an error from the log reader agent with the below error message Procedure or function sp_get_redirected_publisher has ...
0 votes
0 answers
34 views

Automate [Inventory Valuation Simulation Report] in SAP Business One

Without using DI API, I want to achieve the automation of [Inventory Valuation Simulation Report] in SAP Business One 9.3 SQL version, where I can run it for specific items list in a sub SELECT ...
0 votes
2 answers
61 views

Find 18 Month Gaps in Invoice Data with SQL

I need help with this SQL query. I have this table that includes every Invoice since 7/1/2020. The table has CustomerID and InvoiceDt in it. For every CustomerID I need to know if there is an 18 month ...
-4 votes
0 answers
41 views

I am trying to create a table to build a datawarehouse but I had some problem that i couldn't solve it [closed]

This is the problem enter image description here When I imported the source file into the table that I had made it caused a problem a CustomerKey. I couldn't set the type INT for it because the source ...
0 votes
1 answer
43 views

Is it possible to use case in where clause to set a parameter? [closed]

I am trying to pull addresses based on their type from certain accounts. The relation between the two tables is not based off account type but rather a customerId (a customer can have many different ...
0 votes
0 answers
33 views

TIBCO Business Works with AppService > Issues getting Managed Identity for SQL server working (MSI Token Failure) [closed]

MSI Token failure: Failed to acquire token from MSI Endpoint ClientConnectionId: We are using Business Works 2.8.3 (2.9.1 same issue) in combination with App Service (running our containers). Any ...
0 votes
0 answers
38 views

How can I optimize this working TAT query

I need query for TAT report .. I need total working hours only on office hours i.e, 09:00 to 06:00 if time is more that 6:00 the adjust the time to next day starts from 09:00 and also include public ...
0 votes
1 answer
32 views

Export or query for all requests SQL in database SQL in Azure Synapse

I need to analyse the quantity of SQL requests in views of DW database in Azure Synapse. In the tool there is a monitor of SQL requests, but not is possible export the data. There is a table where I ...
-1 votes
0 answers
30 views

I'm trying to execute a powershell script that calls a sql script that executes that query across multiple servers in a registered group into a csv

I keep getting this error: Invoke-Item : Cannot find path 'C:\WINDOWS\system32\backup_data.csv' because it does not exist. At line:32 char:1 Invoke-Item "backup_data.csv" CategoryInfo ...
-2 votes
0 answers
22 views

i have troubles importing the data for mssql into mysql. what could be the problem [closed]

I am trying to use a dataset that was previously used in Microsoft sql server to work on MySQL but I keep running into errors. what could be the problem? i have tried to change the data type but ...
0 votes
1 answer
62 views

How can I search for a DATE in Entity Framework

I'm trying to get a date from my database and I've tried different things, but nothing seems to work. This is my date in the database 2024-04-18 19:47:36.337, it's defined as datetime in Microsoft SQL ...
-2 votes
1 answer
60 views

How do I convert this Knuth hash code in C# to the SQL equivalent?

Can anyone help me to convert the C# code below (Knuth hash) to the SQL equivalent? /// <summary> /// https://stackoverflow.com/a/9545731 /// </summary> static string CalculateHash(string ...

1
2 3 4 5
6697