336,851 questions
0
votes
1
answer
21
views
Using EXECUTE with FORMATMESSAGE
I’ve learned that FORMATMESSAGE() is the closest thing to parameterising a string in SQL Server. So this works for me:
DECLARE @db NVARCHAR(12) = 'test';
SELECT formatmessage(N'USE master; DROP ...
1
vote
0
answers
25
views
ClickHouse JDBC Bridge: "Connection was closed" errors with long-running SQL Server queries
I'm experiencing persistent timeout issues when connecting ClickHouse (v25.2.2.39) to SQL Server through the ClickHouse JDBC Bridge (v2.1.0).
Simple queries work fine: SELECT * FROM jdbc('DWH', '...
-1
votes
0
answers
35
views
How to use JSON_VALUE to extract all bottom level nodes? [duplicate]
I have the following JSON
{
"227865": [{
"friendlyCode": "Schedule Number",
"friendlyName": "Schedule Number",
...
0
votes
0
answers
33
views
Comparing two dates using SSIS conditional split component
CONTEXT
We retrieve data from a local Gas Station where the company's vehicles go to refuel their tanks in a CSV file.
So we save this data: VOLUME, TOTAL_AMOUNT($), PRODUCT (gas, premium, diesel), ...
0
votes
0
answers
35
views
How to Resolve Special Character Encoding Problems in R When Using Remote Desktop?
I need help on how to solve a problem encoding special characters in R.
I am working on a data warehouse project stored in slq server. The data is in French and when I do my calculations, I encounter ...
0
votes
0
answers
25
views
Add column, add trigger, ordering failure
Liquibase diffChangeLog ordering:
I'm using Liquibase to tell us what changes are made on a shared development database. I've run into a reproducible issue.
run diffChangeLog and see that ...
-1
votes
0
answers
35
views
Best Way To "Relate" Data Between Tables [closed]
I have a 2NF relational database currently built on SQL Server. We have a request to have our application be able to link an object, say a book we read, to another object like an employees strength. ...
1
vote
1
answer
61
views
How to display all active IP addresses for SQL Server on Azure?
I have a web app (Blazor, C#) that monitors Azure resources. I need to add functionality for a user to be able to switch between different databases, and depending on which one selected, I display the ...
0
votes
0
answers
50
views
How to display formatted Stored Procedure text in SSRS
I have had a request to display the text from a set of stored procedures in an SSRS report. I can easily get this from the system tables, but the issue is the user wants the text to be displayed in ...
0
votes
4
answers
165
views
Efficiently comparing DATE and DATETIME columns in a SQL query
I've got tables with millions (possibly billions) of rows, so I really need to be efficient with the query.
In this query, I'm joining multiple tables. The segment in question is:
LEFT JOIN
dbo....
-3
votes
0
answers
60
views
Assigning a master key to many related entities [closed]
I have a table of keys of related entities.
For example, I have the following relationships in my relationship table:
EntityKey1
EntityKey2
A
X
B
L
E
X
E
G
X
Z
X
O
Y
L
If one entity is related to ...
0
votes
0
answers
32
views
SQL > WCF-SQL send port [closed]
I'm trying to upgrade one of my send ports in BizTalk from using SQL to WCF-SQL, the old port didn't have many settings in the config other than it's connection string, document namespace and response ...
0
votes
0
answers
43
views
Error connection Docker SQL server : The server was not found or was not accessible
I want to connect to a SQL Server instance in Docker via Microsoft SQL Management Studio.
Here's the docker compose:
services:
reactapp1.server:
image: ${DOCKER_REGISTRY-}reactapp1server
...
-2
votes
0
answers
61
views
How to support regular expression-based search in SQL Server? [duplicate]
I have this query for MySQL:
SELECT TABLE_NAME AS old_name, REPLACE(TABLE_NAME, 'survey', 'responses') AS new_name
FROM information_schema.tables
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME REGEXP ...
0
votes
0
answers
72
views
SQL login with mixed login modes
We are migrating from SQL Server (2022) to an Azure managed instance.
Our tenant is @contoso.com
We have an Azure Managed instance sqltest
We have a singular database MyTestDB
We have enabled mixed ...
-1
votes
0
answers
48
views
Setup Failed when installing SQL Server Integration Services Projects (Error 0x800703F6) [closed]
I am trying to install SQL Server Integration Services (SSIS) Projects extension for Visual Studio 2022, but the setup keeps failing with the following error message:
One of the files in the registry ...
0
votes
1
answer
107
views
Power function gives wrong result
Whether in SSMS or in SQLCMD, if I type
select power (9.0, 28)
I get the wrong result. If I break this down into multiple powers of sixteen, e.g.
select power (9.0, 16) * power (9.0,12)
I get the ...
0
votes
1
answer
68
views
Azure SQL Database Backups PITR & LTR
I have so much confusion how Azure SQL database backups PITR & LTR Works. I have observed few things from the backup as follows;
PITR - Earliest Point in Time Retention happening every day. for ...
0
votes
0
answers
37
views
Using JavaScript with Node.JS to post data to a SQL Server database and return query results from the database
When I attempt to pull data from the database I am getting zero results although my parameter is correct.
From my index.js where CustID is a parameter
app.get('/contacts', (req, res) => {
...
0
votes
0
answers
43
views
Enabling system versioned table to some tables in SQL Server when deployed to AWS
I want to deploy an SQL Server database to AWS RDS or EC2. Now some of the tables in the database require to be made temporary system versioned tables in AWS to be able to perform well as they do on ...
2
votes
2
answers
134
views
Inconsistent results with versions of the same query
I am really confused about the results I am getting when I run the following query:
SELECT
Name, COALESCE(NULLIF(workemail, ''), homeemail) AS empEmail
FROM
MasterList ml
WHERE
NOT ...
0
votes
0
answers
49
views
In nodeJS / SQL Server to bulk insert geometry with SRID?
I need to do a bulk insert (via bcp) into a SQL Server table with geometry data. I figured out how to get the operation working generally, however, there are a few criteria/issues that I have been ...
1
vote
2
answers
74
views
Query returns a date when I select WHERE column = '' [duplicate]
I am running a query to check if any records contain a blank DateOfBirth, but data returned is not what I expected.
I ran the following:
SELECT TOP 5 DateOfBirth, *
FROM [MyDataBase].[dbo].[...
-2
votes
1
answer
54
views
SQL Server connection string Issue with optional encryption [closed]
I had been using a connection string with my application and it had been working without any issue. Username and passwords have not changed but when I run the code, I get this error:
The server ...
1
vote
1
answer
58
views
Gaps and Islands Getting Last Island Window
I have a table with status changes that I want to chunk into islands and eventually get my most current island based on when my status changed. I'm using this query to retrieve the current, previous ...
0
votes
0
answers
47
views
SQL SSRS ReportServer db DROP/Create Objects
I've enable DDL audits on few of our servers. The past two months I've seen a weird behavior on a server where we host our reportserver database.
I'm seeing lots of drop procedures/view followed by ...
1
vote
1
answer
126
views
SQL Server not selecting all records
I am running into an issue I have not seen before. I have a table in one of my SQL Server databases that when I run just a basic SELECT * query against it, it returns 15,114 rows.
However, when I look ...
0
votes
0
answers
44
views
Error 300 VIEW SERVER STATE permission when trying to disable CDC as the SA
Having an issue with the CDC process. I'm trying to add a column to a CDC table and the first step is to disable the current CDC table. I can't get past this step even though I'm logged in as 'sa'. ...
0
votes
0
answers
45
views
The module being executed is not trusted - for procedure "with execute as" clause
I have a stored procedure in a database OmegaCoreAudit that queries the master.sys.fn_get_audit_file records and stores them to a table in the same database.
The owner of this database is login ...
-1
votes
0
answers
46
views
Why am I receiving this empty xmlns? [duplicate]
I'm switching over a BizTalk port from adapter 'SQL' to 'WCF-SQL' due to the former being removed from the next version of BizTalk, I can receive the message from the stored procedure fine, except for ...
2
votes
0
answers
61
views
Schema::hasColumn() returns false for existing SQL table columns using Laravel and external database connection
I'm working on a Laravel 12 project that connects to a Microsoft Dynamics CRM SQL Server database through a custom connection. I've run into a puzzling issue: Laravel's Schema::hasColumn() returns ...
0
votes
0
answers
48
views
"The connection is no longer usable because" sql server connection issue using python and sqlalchemy [closed]
Error code: "Exception: (pyodbc.OperationalError) ('08S01', '[08S01]"
Error message: "Very frequently i am facing this error. the connection get established i run multiple times after ...
0
votes
2
answers
67
views
Organizing data into hierarchical structure with SQL Server
I have a SQL query that I used with SSRS for creating a hierarchical employee report. SSRS had the ability to have recursive parent groupings, which explains the following table structure of the data.
...
1
vote
1
answer
74
views
Fetching 1 row of main table with diverse max()s, min()s, and same-row-as-the-min() values from related tables
table1
tasknum
description
refid
sysdesc
table2
tasknum
stepno
stepdetail
approvaldate
table3
id
startdate
enddate
SELECT
t1.tasknum
, t1.description
, t1.refid
, t1.sysdesc
, t2.stepno
, t2....
-4
votes
1
answer
92
views
Find combination from one table in rows in a different table [closed]
I am building a database to analyze bowling results and bowler performance. I need to find how many times certain pin combinations were hit when a bowler threw the ball the first time. I have one ...
0
votes
1
answer
48
views
PowerApps Pull one to many values by individual entry
I'm using PowerApps with a SQL Server database right now, and I have an Events and an Event_Categories tables. Events has a one-to-many relationship with Event_Categories. Event_ID is the PK for ...
0
votes
1
answer
70
views
What are DATEFIRST's default values for non-US English languages in SQL Server?
SQL Server has a DATEFIRST setting that determines the first day of the week for date calculations.
SELECT DATENAME(weekday, '2025-04-23') AS WeekdayName -- Wednesday
SET DATEFIRST 7 -- Sunday
...
1
vote
3
answers
107
views
Check if a datetime range overlaps business hours on specific days of the week in T-SQL
I have an SQL Server table Meeting with start and end times stored as a datetime. How can I retrieve records where the datetime range overlaps with company business hours. (IE: Monday to Friday, 9am ...
1
vote
0
answers
45
views
Anomalous results from CASE expression [duplicate]
I am building demo data and need to create a randomised code value for each row in my table.
the valid values for the code are weighted with a given percentage value.
In the code below, I generate a ...
-1
votes
0
answers
27
views
How to restore only the Secondary FILEGROUP Backup in a different DB? [migrated]
I have a db with size of more than 300 GB. But I have created two FILEGROUPS and the secondary filegroup contains only 2 tables. I want to take the backup for the that particular secondary filegroup ...
0
votes
0
answers
74
views
Why does my Azure Function app have latency?
I am experiencing an odd problem that I cannot find any solution for the last week.
Wednesday 16/4 ~17.00 suddenly my APIs deployed in an Azure Function app have become much slower.
The architecture ...
0
votes
1
answer
77
views
SqlHelper missing during DataSource set up
I am creating a spring data source manually because of retrieving a password from a vault.
@Bean
DataSource dataSource() {
var password = getSecret(secretName);
final var dataSource = new ...
0
votes
0
answers
55
views
Passing a table-valued parameter to a procedure unit tested with tsqlt.ResultSetFilter
Is it possible to pass a table-valued parameter to an Azure SQL / SQL Server procedure that is being unit tested via tsqlt.ResultSetFilter?
I want to do this because the procedure returns multiple ...
0
votes
0
answers
50
views
sqlalchemy.exc.ProgrammingError: Invalid object name 'users' while querying SQL Server with pyodbc
I am running migration scripts via Alembic, and they are executing successfully. All the tables, including the users table, are created in the SQL Server database without issues. However, when I try ...
2
votes
3
answers
107
views
Nested LAG function (kind of)
I have this table
MachineCode
DoCreation
MachineStateCode
DM139
2024-04-03 00:32:17.377
99
DM139
2024-04-03 00:32:49.080
0
DM139
2024-04-03 01:51:14.427
99
DM139
2024-04-03 01:51:45.643
0
DM139
2024-...
0
votes
0
answers
45
views
Columns created as Hidden in SQL Server are not getting into Fabric warehouse via Data factory pipeline
Doing full initial load of tables in a SQL Server DB into a Fabric Warehouse via Data factory in Fabric (not ADF) pipeline. There are some hidden columns (SysStart, StsEnd) in temporal tables. The ...
-4
votes
0
answers
60
views
SQL Server 2022 with text field to SQL Server 2019 field(date) How can I add this variable to the date column without any problems? [closed]
using (var cmd = new SqlCommand())
{
string incomingValue = hfStartTime.Value.ToString();
string[] parts = incomingValue.Split(' ');
string date = parts[0;
string hour = parts[1];
...
-2
votes
0
answers
65
views
What is the most efficient way to keep an SQL Table updated according to a CSV? [closed]
I want to keep a table in my database to be updated with a public online csv file. The file constantly has new rows added and removed.
I have a VM to run Python notebooks, and an SQL Server.
What is ...
2
votes
2
answers
97
views
SQL update with join is only updating one column
I'm implementing change tracking for user data. Many changes are possible, so I've built a temp table (#ChangesToMake) to hold the basics and am joining that to retrieve details. When updating the ...
3
votes
1
answer
72
views
SQL view still displaying data from a table in a renamed database
I'm using an Azure managed instance of SQL Server and Management Studio. I have created a view in one database (DB1) that pulls a few different columns from a table I created in another database (DB2)....