Questions tagged [sql-server-2019]

Use this tag for questions specific to the 2019 version of Microsoft's SQL Server.

New Features Of SQL Server 2019

  1. Intelligent Query Processing Enhancements enter image description here
  2. Accelerated Database Recovery (ADR) enter image description here
  3. AlwaysEncrypted With Secure Enclaves enter image description here
  4. Memory-Optimized Tempdb Metadata
  5. Query Store Custom Capture Policies
  6. Verbose Truncation Warnings
  7. Resumable Index Build
  8. Data Virtualization With Polybase enter image description here
  9. Last Actual Execution Plan DMF
  10. Multiple Internal Performance Improvements

Reference : What's new in SQL Server 2019 (15.x)

977 questions
1
vote
1 answer

SUM Value Based On Day Near Each Other By A Day

So, I wanted to get the SUM of New Ink (ml) and Ink Used (ml) grouped by Date, Paper Code, and Ink Code but I also wanted the Date group the difference of the Date only by a day Main Table Date Paper Code Ink Code New Ink (ml) Ink Used…
Rohad Bokhar
  • 104
  • 9
1
vote
0 answers

How to get correct values without checking the datatype of each column

I am writing lots of queries to use in reports and statistics, often I need average values, so I use avg(column) but that has a problem look at this example declare @table table (value int) insert into @table values (2), (3) select avg(t.value), …
GuidoG
  • 11,359
  • 6
  • 44
  • 79
1
vote
1 answer

Finding MAX values for each combination of two columns

I've been struggling with this for quite a while now and still cannot find a suitable solution. My situation is that I have a table on SQL Server 2019 that looks like this called…
1
vote
1 answer

How can I split JSON array into its own row?

I am trying to split NPI into their own rows. I can get the NPI values as a comma-separated string but I need to break them down into their own rows. I am able to get all the other fields because they have an object name with single values, NPI has…
1
vote
1 answer

How to grab information of a SQL Server user-defined function's parameters and return type?

I have a user-defined function: CREATE FUNCTION [foo].[bar] ( -- ...parameters ) RETURNS TABLE AS RETURN SELECT ... How can I get information about (the types of) the fields returned by this function, i.e. the return schema? Also, how do I…
Attila Szeremi
  • 5,235
  • 5
  • 40
  • 64
1
vote
1 answer

The SQL Server feature 'SQL_Engine_Core_Inst' error

For few days I am getting an issue with SQL Server 2019 Express Installation. When installing SQL Server I get an error and the server won't work. I've tried repairing it but I've got also an error here. The following error is : Feature: …
Swerk
  • 33
  • 1
  • 7
1
vote
1 answer

Calculate difference between rows based on a condition in SQL Server 2019

I am working on a code which has few events transition status and the duration of the transition status. Below is the screenshot of the data. What I need to find is the difference of duration for each event transition that has the value as "True".…
Karthik Venkatraman
  • 1,619
  • 4
  • 25
  • 55
1
vote
1 answer

Improving and solving long running query

I have a stored procedure that is running unusually long.... Narrowing down. I got the below... Long running query: select @TimeStamp = getdate() select @TimeStamp Use FSFruit; select *, case when @intDaysToGrowInQ1 = 0 then 0 else (me1) end yme1, …
simpleorchid
  • 145
  • 1
  • 10
1
vote
0 answers

Orphans rows due to Missing Foreign keys

I have composite foreign key missing in Production and when tried to create gave error "Alter table conflicted with foreign key constraint". Below is the statement we are trying to execute. ALTER TABLE dbo.tbl_ComputationWebsheetCellData WITH CHECK…
omkar
  • 79
  • 1
  • 9
1
vote
1 answer

Insert results of linked server into temp table from SQL Server 2016 to SQL Server 2019

SQL Server 2016 version: Microsoft SQL Server 2016 (SP3) (KB5003279) - 13.0.6300.2 (X64) Aug 7 2021 01:20:37 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) SQL Server…
1
vote
1 answer

A question again on cursors in SQL Server

I am reading data using modbus The data contains status of the 250 registers in a PLC as either off or on with the time of reading as the time stamp. The raw data received is stored in table as below where the column register represents the…
IoTian
  • 37
  • 5
1
vote
1 answer

Batch database creation using .BAK backups

I'm preparing to test an application in development. The application uses SQL Server 2019 for backend databases. It allows users to maintain multiple databases (for compliance and regulatory reasons). QA testing scenarios require databases to be…
Aaron
  • 13
  • 4
1
vote
2 answers

Stored procedure to add a new order which takes a list of products

I have 3 tables: Products, Orders and OrderDetails. Products ProductID ProductName QtyInStock CurrentPrice 1 Adidas Shoes 10 100.00 2 Nike Shoes 10 100.00 Orders OrderID OrderDate DeliveryAddress 1 27-04-22 1 Smith…
1
vote
2 answers

Is it possible to modify(insert/update) on-premises SQL server using dataflows in Azure Data Factory

I need to update the table which is in the on-premises sql server database using dataflow in azure data factory I have self hosted Integration Runtime Linked services created based on this self hosted Runtime Dataset connection works fine However…
1
vote
1 answer

How to get the first occurrence of a group of values with T-SQL

Having a SQL Server DB table below how can I get the data related to the first occurrence of a series of values (TableA and TableB_S have UserId linked) - I need to get the first occurrence of the last series of IsActive = 1 value (the 5th row in…