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.
sql-server
29
questions
0
votes
0
answers
19
views
SQL Scan vs Seek when using OR in where criteria
Consider the following two queries from the AdventureWorks database. The where criteria is entirely on indexed columns. If you use OR criteria both tables get a full table scan on them. In the second ...
1
vote
0
answers
10
views
Role permissions to trigger SQL Server Service Broker
We have a Service Broker that listens for changes to the database and then sends messages to a queue based on the changed data. This works if the logged in user is has a server role of sysadmin or ...
0
votes
0
answers
11
views
Is it possible to get md5 of the entire table in SQL Server? E.g., by hashbytes
We want to get the md5 checksum of the entire table to verify the consistency of data, e.g. using the hashbytes() function of SQL Server.
As an intermediate step in the proof of concept, we figured ...
-3
votes
0
answers
22
views
Custom SQL Server datediff function with same logic as databricks [duplicate]
So apparently datediff on Databricks has different behavior compared to SQL Server.
One month is considered elapsed when the calendar month has increased
and the calendar day and time is equal or ...
0
votes
0
answers
35
views
How to create a file in another server using T-SQL
I have 2 servers; one server hosts a SQL Server (which is a Windows machine), and the other one is a linux system.
I want to export the data from the SQL Server instance to linux system. While I was ...
0
votes
0
answers
54
views
Get the no.of records Inserted in last 10 days
In my table I didn't have primary key and forgot to add timestamp column. Now I would need to find the records with date time of insertion in last 10 days. Is there a way to find this? If yes then how?...
0
votes
0
answers
16
views
Azure Pipeline timeout with testcontainers
I have a similar issue as this: Testcontainers: Azure pipeline test stage reach timeout of 1hour
I would have commented there but I can't comment because I don't have 50 reputation.
It's the same case,...
-3
votes
0
answers
53
views
Why am I getting the wrong value or NULL after doing left joins? [closed]
I have a table called Persons with an ID column. I have another table called Cases which has an ID, another PersonID, and the date that the case was made. I have a third table called PersonsCases, ...
-1
votes
0
answers
52
views
Improve performance or change query so it can be an indexed view
We have this query in a non-indexed view in SQL Server 2022.
It's used everywhere and I'm trying to improve the performance. A lot of queries we use elsewhere join to it.
My thought was whether there'...
0
votes
0
answers
34
views
Unable to Connect to Azure SQL Server Database Using JDBC Driver in Android App
I'm developing an Android app and trying to connect to an Azure SQL Server database using the JDBC driver. I'm encountering a java.lang.AssertionError related to SSL/TLS communication. Below is the ...
-3
votes
0
answers
23
views
Can not connect to SQL Server [duplicate]
I try to change IP address and restart the SQL Server at services.msc, reload too many time, and I get this error:
TITLE: Connect to Server
Cannot connect to DESKTOP-1GSM5LI\ZUN.
ADDITIONAL ...
-4
votes
0
answers
32
views
Validating rules [closed]
I've a table data:ORG ER |ACT | BUD N |ACT N_1
I identify the cases where I need to identify the ORG ER which will be rejected and I need to insert it in a table of reject.
Here the rule 1 that ...
0
votes
1
answer
41
views
Get all hierarchy in SQL Server
I have a table like this:
ID_employee
ID_Manager
1
1
2
1
3
1
4
2
5
3
6
5
7
5
8
5
(1 is a boss)
What I would like is a result like:
ID_employee
ID_Manager
8
5
8
3
8
1
7
5
7
3
7
1
6
5
...
-2
votes
0
answers
17
views
i have this error The page cannot be displayed because an internal server error has occurred [closed]
When I uploaded the site to the host, there was no problem. But when we are working with the site. For example, we return to the main page or perform a delete operation, this error occurs!
I ...
0
votes
0
answers
18
views
Uipath connect to SQL Server and use bulkinsert - get System.Exception error
I have an Excel file with 750,000 records. I first use read range to load it into a data table.
To avoid issues with large volumes of data, I used a For Each loop to split the data and perform bulk ...
0
votes
0
answers
35
views
TinyTDS Login failed when TSQL connects -
I have a RoR API only app:
gem 'rails', '~> 7.0.8'
gem 'activerecord-sqlserver-adapter', '7.0.7'
gem 'composite_primary_keys', '14.0.9'
gem 'tiny_tds', '2.1.7'
The ubuntu server connects just fine ...
0
votes
1
answer
56
views
Query between two dates gives incorrect results in SQL Server? [closed]
Im trying:
SELECT *
FROM database a
WHERE Applicant_End_date >= '2024-01-01'
AND Applicant_Start_date <= '2024-06-30';
Results:
Applicant_End_date shows results starting at 2024-01-01 like:
...
-1
votes
0
answers
45
views
SQL query to return the MAX(CreateDate) from tables that are returned in the initial result set?
Working on a SQL Server Management Studio query. The goal is to return the MAX(CreateDate) and table names from a query that returns a set of values from a column called WhenSQL. Each table has its ...
0
votes
0
answers
24
views
Issue with Building .sqlproj Project on macOS Due to Missing SSDT References
I'm currently working on a .NET 6 project. It includes a .sqlproj file for database schema management.
Problem faced
When trying to build the project with the .sqlproj file on macOS, I get build ...
-1
votes
1
answer
58
views
SQL JOIN to the same table explanation
I am refactoring some code that was written by another person that is no longer around. In this query a MAX(Date) is being selected, but then joined to they same table via MAX(Locator). The locator is ...
0
votes
0
answers
14
views
SSRS subscription parameters storing numeric values instead of names
I am working on extracting the subscription parameters from the SSRS report server DB. I have parsed the XML out so that I get the parameter name and its value. See here. However, a lot of the values ...
-1
votes
1
answer
37
views
Getting a timeout only in GitHub Actions when trying to use SQL Server with TestContainers
This is my first time trying to use TestContainer. I am using it to make sure the tests run on a fresh database. This works with Docker Desktop locally and runs quite fast. I am now testing to see how ...
0
votes
1
answer
17
views
Docker Grafana - VPN to MSSQL not connecting [closed]
I have a grafana container running on my linux server. I am trying to get a connection from Grafana to my MSSQL server which is on another network but VPN connected.
From the linux server running ...
0
votes
1
answer
17
views
How to grab text after a special character in a join [duplicate]
I am doing a select query, and trying to join in another table where the common field in one table looks like "1234" and the other table has a comma and characters at the start like "BA,...
0
votes
1
answer
67
views
WITH (NOLOCK) /SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED on stagnant data [duplicate]
I will prefix this by saying I may be misunderstanding / misinterpreting something here!
Our IT dept requests we update queries / stored procedures to use NO LOCK. I need to add that to every stored ...
2
votes
1
answer
132
views
Why is C# DateTime.Now/DateTime.UtcNow ahead of SQL Server's SYSUTCDATETIME()/SYSDATETIME() even though C# code executes before the SQL Query
I want to know the reason why my C# date is larger than the SQL date even though the C# code is running first and after that the SQL query,
Logically the SQL date should be greater than C# date.
For ...
-3
votes
0
answers
47
views
Not able to get multiple tables with different data properly [closed]
I want to populate a Jasper Report with multiple tables for given range of employees to show their details fetched from a SP and populated in my table in each page.
But whenever multiple employees ...
-2
votes
0
answers
48
views
Select rows from database using dapper dynamic and reconstruct into custom object list in C# [closed]
I am fetching data from the database using Dapper as a dynamic list.
ID
ATTR
ATTR_VALUE
1
A
CAR
1
B
BUS
1
C
TRUCK
2
A
CAR
2
B
BUS
2
C
TRUCK
I have tried mapping the above dynamic data to the ...
0
votes
0
answers
32
views
Is there a way to summarize individual totals under one category? [duplicate]
I am supposed to create an SQL query that determines the total hours of certain projects from two tables, totals them per month and lists them.
I've got these tables:
Table "A"
ID
Name
1
...