|
|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Backing up a damaged database | |
I have a SQL Server 2019 database that is damaged, but the log file appears fine. What options do I need to include to back up the tail of the log for this damaged database in the BACKUP LOG command besides the name and backup location? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Encrypting the Database Encryption Key I am configuring Transparent Data Encryption for a new database and need to create a Database Encryption Key (DEK). As I architect this, I need to secure this key. What are my options for encrypting the DEK? Answer: certificate or asymmetric key Explanation: An asymmetric key or a certificate (which is an asymmetric key) can be used to encrypt the DEK. Ref: CREATE DATABASE ENCRYPTION KEY - https://learn.microsoft.com/en-us/sql/t-sql/statements/create-database-encryption-key-transact-sql?view=sql-server-ver16 |
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
SQLCMD does not write the results of a RESTORE command to the log file or tty - I'm in the process of converting some scripts we use to restore SQL Server databases to use SQLCMD. The scripts currently use the osql utility. I thought SQLCMD would have all the functionality of osql plus more but it doesn't seem to output the stats and a "RESTORE DATABASE successfully processed" to a file or […] |
blocking issue - Hi All, We are seeing SELECT's blocking DML's like UPDATE statements. When we tried to check with application team, they said they are using with (ROWLOCK) hint in most cases. So, I tried to repro but not able to reproduce the issue of SELECT with (ROWLOCK) hint blocking UPDATE statements. Are there any cases where […] |
SQL Server 2017 - Development |
Dimensional table and Stored Procedure - To meet these requirements below, I came up with this SQL. Please evaluate my code if it produces the requirement(s) result. A dimensional table and procedure that tracks Primary Accounts’ group movements. An account moves to different groups that are associated with levels of commission paid. Analysts needs to follow how they moved over time. […] |
SQL Server 2016 - Development and T-SQL |
find connection details for all ssis jobs - Hi, is there are way using sql that brings a list of the ssis packages deployed along with the details of the connections used. There are approx 100 packages and to manually open is not realistic. So I'm interested to know which packages/dtsx are using a OLE DB connection and which database name it's connecting […] |
Development - SQL Server 2014 |
Use of an NCI - that does not contain the Column required. - Hello. I am a bit confused and not sure what terms to use to Google. I have a transaction that overran this week and DPA gave me an Estimated Execution Plan that showed a Missing Index Hint - which I understand. The Table has 3.5Million Rows and the SQL is doing an Equality Search in […] |
SQL Server 2012 - T-SQL |
Anderson-Darling Calculation - Hi I am following an article posted on sql server central on the anderson-darling calculation. https://www.sqlservercentral.com/blogs/goodness-of-fit-testing-with-sql-server-part-7-3-the-anderson-darling-test The code has worked, but is out by 0.001. I have used two programs, MiniTab and Excel Workbook to compare answers and they get a result of 5.808, but i cam getting 5.807. Excel book I have looked […] |
SQL Server 2019 - Administration |
Re-creating AG after server loss - We recently had to rebuild servers that were configured with AG. I built everything from scratch, but I am wondering if there is any way to recover AG configuration from master db? os backups... Thank you. |
Does SQL Server eventually terminate idle connections to the database? - We are only trying to answer the below questions regarding database connections for an audit. We are not having any issues, and nothing is broken. We are running SQL Server 2019 on Windows. 1. Does SQL Server eventually terminate idle connections to the database? 2. How to terminate an idle connection to a SQL Server […] |
SQL Server 2019 - Development |
Cannot run DynamicSQL Statement to merge table with JSON - Hi there I have a problem with a dynamicSQL Statement. In this code, I have some data come in JSON format, with which i want to perform a merge operation on an existing physical table. I declare the JSON as nvarchar(max) and able to print this out However when I place this JSON in my […] |
Can you help me understand what this stored procedure call returns? - Definition of stored procedure create procedure [dbo].[smGetMinDate] @O_dMinDate datetime = NULL output as declare @dDefaultMinDate datetime select @dDefaultMinDate = GETDATE() select @dDefaultMinDate = DATEADD(mm,-(DATEPART(mm,@dDefaultMinDate))+1,@dDefaultMinDate) select @dDefaultMinDate = DATEADD(dd,-(DATEPART(dd,@dDefaultMinDate))+1,@dDefaultMinDate) select @dDefaultMinDate = DATEADD(yy,-(DATEPART(yy,@dDefaultMinDate))+1900,@dDefaultMinDate) select @dDefaultMinDate = DATEADD(hh,-(DATEPART(hh,@dDefaultMinDate))+0,@dDefaultMinDate) select @dDefaultMinDate = DATEADD(mi,-(DATEPART(mi,@dDefaultMinDate))+0,@dDefaultMinDate) select @dDefaultMinDate = DATEADD(ss,-(DATEPART(ss,@dDefaultMinDate))+0,@dDefaultMinDate) select @dDefaultMinDate = DATEADD(ms,-(DATEPART(ms,@dDefaultMinDate))+0,@dDefaultMinDate) select @O_dMinDate = @dDefaultMinDate return stored […] |
SQL Server 2019 error and Usage reporting not starting - we use two SQL instances on one server - both SQL Server 2017 and SQL Server 2019. I can turn-off SQL Server 2017 error and usage reporting service as shown in the screenshots, but when I open error and usage reporting service for SQL Server 2019 in a cmd window, and then close automatically and […] |
Storing a text file in a VARCHAR(MAX) column - I'm using OPENROWSET to put the contents of a text file into a VARCHAR(MAX) column. However, it is stripping the carriage returns and line feeds out, so when I put the contents of the column back into Notepad I get one long line instead of the original text file. Is there a way to prevent […] |
Reporting Services |
Restrict available values from one parameter per othr parameters selected values - Hello Have created a simple 9 column report where there are 7 (multi valued) parameters all reference the same table. I want all these parameters to reference one another. So, for example, once a user selects values from parameter 1, restricting say departments to 3 departments, then the rest of the parameters, once selected should […] |
SQL Server 2022 - Development |
"ID" primary key from two separate tables as a foreign key in a new table - I have two tables: tblProfessors with ProfessorID as the primary key and tblStudents with StudentID as the primary key. I'm wondering if it's possible to create a single foreign key (ID) in a separate table that is a combined list of ID's from tblProfessors and tblStudents. Here is the script for both tables: CREATE TABLE […] |
Identity column and "EntityID" column naming convention - This isn't* specific to 2022, but SQL in general. I will be joining a full green field development project of a new application. One of the things I will be setting as a standard will be to ban the use and visibility of identity primary key columns to end users or (especially) report writers and […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |