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
2 answers

Can I use an OPTION clause inside a function in T-SQL (SQL Server)?

I want to write a function like this: CREATE OR ALTER FUNCTION TestFunction() RETURNS TABLE AS RETURN WITH NumberList AS ( SELECT 1 AS Number UNION ALL SELECT Number + 1 FROM NumberList WHERE Number < 1000 ) SELECT …
Daniel Jonsson
  • 3,261
  • 5
  • 45
  • 66
1
vote
2 answers

Execute SQL query with sqlcmd within specific version

I need to execute this command: SQLCMD -d dbname -i sc.sql to run some queries. Since I have both version 2019 and 2016, the query is executed with 2019, but actually I need that on 2016. I have the same name of database on both version moreover,…
lady
  • 356
  • 1
  • 2
  • 14
1
vote
1 answer

Execution plan says No Join Predicate but if I hard code the ID for the where clause instead of using a variable, it's fine

I am totally bewildered by this one... Execution plan says No Join Predicate but if I hard code the ID for the where clause instead of using a variable, it's fine... DECLARE @TableOneID int = 1234 SELECT TableOne.JustAField,…
msimmons
  • 146
  • 1
  • 3
  • 15
1
vote
3 answers

"Invalid data for UTF8-encoded characters" exception in SQL Server 2019

Environment: VB.NET, VS 2022 (latest build), SQL Server 2019 (latest patch) I'm attempting to execute a simple INSERT of varchar data containing certain UTF-8 data, and regularly getting the SqlException "Invalid data for UTF8-encoded characters"…
pbickford
  • 59
  • 1
  • 14
1
vote
2 answers

SELECT * FROM OPENJSON -- Not getting expected values

I am getting 0 row when selecting from OPENJSON below. I am expecting to get all 3 values "AA" for different as_of_date for CREDIT_RTG . I tried different select statements. I am running in SQL 2016. Expected result should be similar to this enter…
Overflow
  • 11
  • 2
1
vote
0 answers

Archive old records using SWITCH to another table and avoid having to backup this "stale" data repeatedly

This question is about the SQL Server 2019. Scenario: I have a source table, which is partitioned by MonthId (YYYYMM). I also have an archive table of identical structure (except it lives in a different schema). As the time goes by, the older…
1
vote
0 answers

How to force SQL Server Optimizer to drop outer table in left join

I have a view that is: SELECT a.Id , a.col1 , a.col2 , b.col3 FROM a LEFT OUTER JOIN b ON a.Id = b.Id Table A takes very little time to query and table B takes a long time to query. I want to query the view like so: SELECT Col1 FROM view In dev,…
1
vote
0 answers

Precision error when using OPENQUERY and Global Shop Solutions/Actian backend

I am querying Global Shop Solutions (backend is Actian) and I'm using OPENQUERY to perform an aggregate operation and then pull those records into SQL Server 2019. When I run the code below, I get this error: Msg 7354, Level 16, State 1, Line…
1
vote
1 answer

Cannot connect to SQL Server on Linux Docker host (connection forcibly closed by the remote host)

When I want to connect to SQL Server instance running in Docker container, I'm getting following error: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider,…
Rade Tomovic
  • 298
  • 2
  • 14
1
vote
2 answers

SQL Server 2019 and path for JSON_QUERY

I'm trying to extract data from Json stored in a column and save as relational data in tables. The Json represents submissions of a pre-start checklist by a driver. The input data is stored in a table, with SubmitId being the primary key and…
Hecatonchires
  • 1,009
  • 4
  • 13
  • 42
1
vote
1 answer

Import or skip locked excel file while loading a lot of xlsx files on shared drive

I am importing the contents of a bunch of excel files into a database. Basically importing all the files in a folder on a shared network-drive. I am using a for each file enumerator for this. Works like a charm. However, if one of those files is…
Henrov
  • 1,610
  • 1
  • 24
  • 52
1
vote
1 answer

SQL Server Management Studio: Policy - ExecuteSql throws error if the statement string contains an empty field

I want a SQL Server Management Policy to check the values in a delimited list returned by FOR XML. The problem is that "FOR XML ('')" will throw a SQL error. I may not post screenshots or site-specific details so I will demonstrate the error using a…
1
vote
1 answer

CTE ROW_NUMBER() OVER PARTITION based on a value

SQL Server T-SQL CTE ROW_NUMBER() OVER PARTITION based on a value Want numbers based on NAME, VAL1, and VAL2 columns, then order by DT dates descending. WITH cteA (NAME, VAL1, VAL2, DT) AS ( SELECT 'A', '7100', 'PN1', '2023-03-01' UNION …
nrc
  • 25
  • 3
1
vote
1 answer

What permission do I need to give a SQL Server login so that they can query sys.sql_modules?

The SQL login has server roles public and db_creator. It has the server as a securable and has the Connect SQL permission. I used the command below to give it the VIEW SERVER STATE permission, but when I query the sys.sql_modules table it doesn't…
TheMortiestMorty
  • 421
  • 2
  • 4
  • 12
1
vote
0 answers

Unable to create a new asynchronous I/O context. . Please increase sysctl fs.aio-max-nr

Getting the above error message at random times when we spin up the DB image in K8. Current fs.aio-max-nr is 65536 and I can increase it to 1048576 bytes(it will require approvals so might take time) as per the error message but in the logs I can…