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.
334,730
questions
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....
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 &...
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 "...
-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 ...
-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
...
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
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
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
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 ...
-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 ...
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 ...
-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 ...
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 ...
-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 ...
-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)) ...
-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:
# ...
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 ...
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
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
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 ...
-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 ...
-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 ...
-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
34
views
SqlTransaction is disposed unexpectedly when SET IDENTITY_INSERT fails
I am facing an issue with SqlTransaction, where the transaction object is rolledback and disposed unexpectedly. This seems to specifically occur when SET IDENTITY_INSERT is called on an unknown table. ...
-3
votes
0
answers
47
views
SqlCommand in C# doesn't change any values [closed]
public IActionResult Update(Client client)
{
int n;
string query = "update clients set name = @name, email = @email, phone= @phone, address = @address where id = @id";
using (...
-2
votes
1
answer
70
views
Is there a way in C# to override the 8000 byte limit when using SQLDataReader.GetBytes? [closed]
I have a database that has file data stored in an image column. I need to be able to extract the data in this image column and create a document on disk.
I am using C# to run the queries, extract the ...
0
votes
1
answer
40
views
I get this error System.Data.SqlClient.SqlException (0x80131904): Operand type clash: int is incompatible with image
When I want to take a product image from the program and save it in the database, this happened
I try to save an image in byte array after that save in database,
but imagebyteArray returns (int).
I ...
-3
votes
0
answers
24
views
Data not loading on Page refresh in blazor webassembly standalone app [closed]
I have created a sample web app in blazor as webassembly standalone app,
then I simply published this web app in a local folder and hosted it in the iis as a website.
I browse the site it worked ...
-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 ...
0
votes
1
answer
30
views
How to send NULL value from an R script to a REAL type column in SQL
I defined variables as:
OVERLAY_LEVEL <- "overlay"
OVERLAY_LEVEL_NAME <- "OVERLAY_LEVEL"
BASE_WEDGE <- "base"
OVERLAY_TYPE <- "Get_OVERLAY_TYPE"
...
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 ...
0
votes
0
answers
51
views
SQL Server database inserts occurring days later after timestamp [closed]
I'm seeing behavior in our production database that is currently unexplainable. We receive data from remote devices that require an online connection, and we use that data to create records in one of ...
-1
votes
0
answers
23
views
Trying to delete all the traces after incorrect deinstallation of SQL Server [closed]
I tried to completely delete SQL Server and it didn't go well as after deinstallation I tried to reinstall it and failed. I get the same error every time.
Here is what I found in the summary log:
...
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
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, ...
0
votes
0
answers
33
views
Unable to seed data with Docker
I'm trying to use docker-compose to spin up an ASP.NET Core Web API and a SQL Server instance, but I also want to seed my database when it starts up.
For this, I need SQL Server to be up and running ...
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
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 ...
-1
votes
1
answer
43
views
SQL query to calculate elapsed times from process data and timestamps
From the sample data shown below, I need to write a SQL query to identify the elapsed time of both the individual task and the overall session (accumulated elapsed times of all the previous tasks).
...
-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
vote
1
answer
75
views
Why is a LEAST column expression considered imprecise and not indexable?
I have a SQL Server database project:
With COMPATIBILITY_LEVEL = 160
With ANSI-compliant SET options:
ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, and ...
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
1
answer
37
views
SQL Update affecting more rows than expected from a query
I worked on a SELECT query that returned 2 rows when I was testing on my db :
SELECT c.CandidateId
FROM Candidate c
INNER JOIN (
SELECT CandidateId, MAX(UpdateDate) AS MaxDateStatut
FROM ...
0
votes
0
answers
33
views
Python script not returning results from MSSQL stored procedure, despite successful execution
I'm encountering an issue with retrieving results from an MSSQL stored procedure using a Python script. Here's the problem:
I have a stored procedure getlive_value in my MSSQL database ...
1
vote
1
answer
42
views
Dapper how to pass object with list of objects into stored procedure
I have a problem with executing an existing stored procedure using Dapper. The stored procedure takes some parameters and list of user-defined type object. I mimicked the required parameters in C#, ...
0
votes
0
answers
16
views
Configuring 3:1 Failover Cluster for SQL Developer Edition on Windows Server with AWS AMI [migrated]
We are in the process of configuring a 3:1 failover cluster mechanism for SQL Developer Edition hosted on Windows Server, deployed using an AWS AMI. Our objective is to ensure that if any of the three ...
0
votes
0
answers
28
views
Get information about a Sleeping CURSOR
I am detecting too much sleeping sessions on my SQL Server Instance, this sleeping sessions sometimes are causing blockages with other sessions.
The main problem is related with the Event info of this ...