1,168 questions
2
votes
2
answers
186
views
Join on one column and if null join another column
I need some help handling null columns in joins. I have three tables (below are just examples) Map, Employee and Region. Primary table is Map where I join Employee table on the MapID column to get ...
1
vote
1
answer
13k
views
Is it possible to uninstall or update the "Microsoft SQL Server 2019 Setup" program that is installed by SQL Server independently?
I'm looking for advice or recommendations on what should be done with the "Setup" program installed during the installation of SQL Server 2019 or 2022. After installation, can/should the ...
2
votes
1
answer
13k
views
Cannot connect to SQL Server 2019 using new MSOLEDBSQL
I am converting my application to use MSOLEDBSQL from SQL Server Native Client 11.0
I have changed my connection string from "Driver={SQL Server Native Client 11.0}" to "Provider=MSOLEDBSQL" along ...
6
votes
2
answers
133
views
Parse multiple JSON items from a table cell
My table in SQL Server with an nvarchar(max) column holds multiple JSON arrays in each cell. I am trying to parse the 'result' items into separate rows.
JSON array:
[
{"successful":true,
...
0
votes
1
answer
38
views
Can I connect a Mendix app to SQL Server Reporting Services?
Is it possible to connect with an SSRS report from the Mendix application?
I have prepared a report in SSRS, but I am not able to integrate it with the Mendix server.
In Mendix, there is a native ...
2
votes
3
answers
116
views
Query count & sum nested selects into a Grouped Category
My current project/issue is we have a list of permit types. With these types they are needing to be grouped by an overall category. Once grouped out the end goal is to count how many within specified ...
0
votes
0
answers
197
views
OR is slower than two NOT EXISTS? [duplicate]
I have the following two queries. The first runs in less than 1 second. The latter query takes minutes to run. All of the columns being joined are indexed. Both queries are doing the same thing, the ...
2
votes
2
answers
134
views
How do I solve a BCP utility error when importing a CSV?
My input files are on my local drive c:/, and I use Trusted Windows authentication to SQL Server.
All bcp discussions are quote old, I have a feeling that it has been replaced with something else (?). ...
0
votes
0
answers
65
views
Save column name in a variable
I want to save column name in this code to set @Y2:
DECLARE
@H AS NVARCHAR(50),
@X AS FLOAT,
@Y1 AS FLOAT,
@Y2 AS FLOAT
-- , @COLNAME AS NVARCHAR(50)
SET @H = 'PROD1';
SET @X = 10;...
0
votes
0
answers
92
views
SQL Server move table with constraints primary key
I have a table with clustered primary key. I want to move this table to separate file using filegroup.
As I understand - the best way to do it is to DROP and recreate the clustered index, but when I ...
0
votes
1
answer
587
views
SSMS saves in a different encoding when saving a modified stored procedure instead of a new file
I have a problem while saving a stored procedure in SSMS, without specifying encoding: default encoding is UTF16-LE BOM instead of SQLFile.sql that uses UTF8...
I need it to be UTF-8 for git ...
0
votes
1
answer
108
views
Is there a maximum number of rows you can specify for TOP on SQL Server? [duplicate]
When writing a query with the TOP clause in Microsoft SQL Server 2019, is there a limit to how high a number you can specify before the query fails? For example:
SELECT TOP 9999999999999999
FROM table
...
4
votes
3
answers
31k
views
Unable to install SQL Server(setup.exe) Exit code decimal: -2061893606
This is what happens when the installation is completed.
I've tried deleting every residual file from previous installations and I've even restarted my laptop and tried installing the express version ...
0
votes
1
answer
203
views
Fetch data from EntraID into SQL MI table
We have a Azure environment and a SQL MI instance (with SSMS) and a Azure AD (EntraID) that is handled by the security team at our company.
Today we are reading Active Directory data via SQL Server ...
-1
votes
1
answer
79
views
Remove variable length prefix of a string
In the query shown here, I need to keep the numerical part of the column code1 when it starts with T and concatenate it with code2 to get the code I want.
With other RDBMS, I would have used regex ...
0
votes
1
answer
89
views
Error while "execute as" in a procedure to query table in another database on same server
I need assistance executing a procedure inside one database to query another database on the same SQL Server 2019 instance. I can run the procedure fine as myself, but I can't use execute as in either ...
4
votes
4
answers
32k
views
SQL Install Error: The MOF compiler could not connect with the WMI server
I needed to move (some of) my sql install from C: to D: because of space. SQL installer insists some of it stay on C:. Then I needed (decided) to reinstall it, but sql would not do the reinstall. ...
1
vote
2
answers
227
views
SQL Server Replication, DB Engine & Full-Text and Semantic Extraction status failed
I was trying installing SQL-Server 2019 on my computer and I ran into an issue with the installation. I've tried the custom one to get more informations and I have 3 issues.
Here are the errors :
[ ...
1
vote
2
answers
93
views
Find records using max date but exclude time
I need a query to pull records from a SQL Server table based on the max date in the InsertDTS column and the date should not be included in the output.
The InsertDTS column is defined as Datetime. I ...
1
vote
0
answers
329
views
SQL Server dacpac deployment not to drop and create indexes if they already exist
Using Azure Devops for SQL Server 2019 database dacpac deployment with Visual Studio 2019 is dropping and creating index how do I change it not drop and create index for every deployment. how to ...
1
vote
2
answers
114
views
How to insert multiple rows from a single row?
How do I copy few rows from one SQL Server table into many rows in another? Table1 has a [Qty] column. I want to copy every row from Table1 into Table2, each row copied [Qty] times.
Sample data:
...
0
votes
0
answers
39
views
Carry forward the last non null value [duplicate]
I have a simple table like this:
Api_No14 Prod_Date Oil_cf
42317448360000 2023-07-27 639.2337
42317448360000 2023-07-28 864.22
42317448360000 2023-07-29 NULL
42317448360000 2023-07-30 622....
0
votes
3
answers
98
views
CTE to match days after discharge and days supply from prescription
I'm assuming CTE is the most efficient way to do this, but any suggestions would be great. I think I can do this in multiple steps a different way if I have to, but would love to make this as ...
1
vote
1
answer
110
views
Creating a balance statement
So based on a start date of 5 years ago on the 07th February – I want to generate 5 rows - one per year from the start date. If the start date was 8 years ago - 8 rows.
Year
StartDate
EndDate
1
07-02-...
2
votes
0
answers
191
views
Job execution status run check never completes
I have a process where I check for SQL Server agent job execution status making sure all the jobs in question have their last run for the given date completed reporting either success or failure. ...