Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

Daily Coping Tip

Help others by giving away something you don’t need

I also have a thread at SQLServerCentral dealing with coping mechanisms and resources. Feel free to participate.

For many of you out there working in a new way, I'm including a thought of the day on how to cope in this challenging time from The Action for Happiness Coping Calendar. My items will be on my blog, feel free to share yours.

Happy Holidays and Merry Christmas

I looked back at my thoughts last year, on Christmas Eve. It seems so long ago, and yet, not so long. Some things changed back from the strange 2020 world to more like 2019 for me, but not many. Instead, I found myself navigating a world where many things changed, including my personal life as my children have grown up and moved on.

This year I find myself less disrupted in life, coping better, and mostly going along with the flow of the world. I hope that those of you reading this are finding the world easier to live in now than last year, and you have things to look forward to in 2022.

I've said it over in different editorials and presentations, but remember that we work to live, not live to work. Enjoy the time you have with loved ones and friends, appreciate the good things, and do your best to get past the bad. Reach out when you need help and ask for it. Give others support as often as you can.

Above all, find reasons to smile more days than not.

Happy Holidays, and Merry Christmas.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
SQLServerCentral Article

CData Connect: Derived Views and Query Federation

JerodJ from SQLServerCentral

Enterprise-scale data integration demands scalable tools to not only centralize and curate data at scale, but also efficiently explore and analyze data at large-scale. CData Connect solves the challenge of data exploration and discovery through virtualized connectivity to data distributed across many data sources. In this article, we explore the Derived Views and Query Federation features […]

SQLServerCentral Article

Query Performance Diagnostics with sp_PerfSQ

Edward Haynes from SQLServerCentral

This article discusses sp_PerfSQ a diagnostic tool designed to quantify performance features of database queries with active requests. It includes a behavioural parser and can assist in troubleshooting complex performance issues.

External Article

Implementing Deduplication Logic in the Lakehouse using Synapse Analytics Mapping Data Flow

Additional Articles from MSSQLTips.com

Learn how to perform data deduplication for Azure Synapse Analytics using Azure Mapping Data Flows.

External Article

Bulk Loading Data via a PowerShell Script in Flyway

Additional Articles from Redgate

How to quickly and automatically bulk load test data once Flyway Teams completes a database migration. A baseline migration script creates the empty database version, which then triggers a PowerShell callback script that bulk loads in the right version of the data. It is a very fast way to provision multiple copies of a specific database version, complete with data, for ad-hoc or automated testing.

Blog Post

From the SQL Server Central Blogs - Power BI DAX Getting the Value of Previous Non-NULL Row

DataOnWheels from DataOnWheels

If you are an avid report designer or user, you may have wanted to see the percent difference between one row and the previous one. Sounds easy right? Well...

Blog Post

From the SQL Server Central Blogs - Getting Started with the Advent of Code as a #SQLNewBlogger

Steve Jones - SSC Editor from The Voice of the DBA

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers. If you want to get started blogging, or...

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

The Gift Mask

Secret Santa has a table that contains a list of gifts purchased for individuals. There is a column, called giftprice (numeric 8,2), in here, where the value of the gift is stored. Secret Santa doesn't want anyone to know the prices, and applies this code to the column:
ALTER TABLE dbo.SecretSantaGifts ALTER COLUMN giftprice ADD MASKED WITH (FUNCTION='DEFAULT()');
None of the recipients of gifts have the UNMASK permission. If one of them queries a row that contains a value of 99.99, what is returned?

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)

Checking the Sequence

If I want to get the next value that will be returned for a sequence object, called MySequence, what query should I run?

Answer: SELECT CAST(current_value AS INT) + CAST(increment AS INT) FROM sys.sequences WHERE name = 'MySequence';

Explanation: The current value in sys.sequences is the last value used. The next value is this added to the increment, however, these fields are sqlvariant and must be cast to a numeric value to perform the addition. Ref: sys.sequences - https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-sequences-transact-sql?view=sql-server-ver15

Discuss this question and answer on the forums

 

 

 

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 - Development
Backup a line of a table if a row is updated - Hi there! I have an SQL table called ORIGIN with 5 fields. Each time one of the field in changing, I would like this line to be copied to another table called BACKUP. What i am trying to achieve is to have a simple way to do backup that is accessible to the end user. […]
SQL Server 2016 - Administration
SQL Reports a Checksum error but the expected and actual are the same - Is SQL reporting a false positive.. I see where the expected checksum is the same as the actual. 12/15/2021 12:05:00 PM -> Step 1 [Run agent.]: Executed as user: GLOBAL\s-any-sql-sc. Removed 8 replicated transactions consisting of 1379637 statements in 525 seconds (2627 rows/sec). [SQLSTATE 01000] (Message 21010)  The operating system returned error incorrect checksum (expected: […]
TDE Encryption - I have one DB in of my dev server which should be encrypted like any other DBs on that server. So when I run this command, I see the status 'ENCRYPTED" SELECT DB_NAME(database_id) AS DatabaseName, encryption_state, encryption_state_desc = CASE encryption_state WHEN '0' THEN 'No database encryption key present, no encryption' WHEN '1' THEN 'Unencrypted' WHEN […]
SQL Server 2016 - Development and T-SQL
SSIS Pkg being executed twice at the same time under different service accounts - Hello, I have a SQL Job that runs daily at 11pm. Recently we have noticed that pkgs being executed in a job step are being executed twice with a start time almost the same. The pkg All Execution history shows that each run was under a different service acct. I've used RedGate SQL Search and […]
Development - SQL Server 2014
IsNull Statement - Hi How the below statement works - AND Table1.ID2 = ISNULL(@Parameter3, Table1.ID2) Thanks
if condition not working - Hi I have given only date parameters . All other null , but it is not going in If condition -- ============================================= Alter PROCEDURE [dbo].[Ind_sp_CabProfitability] @frDate date, @toDate date, @VCode nvarchar(15) = null, @VName nvarchar(100) = null, @CCode nvarchar(15) = null, @CName nvarchar(100) = null, @CGroup nvarchar(15) = null as begin If @VCode is Null […]
Multiple Parameters - Hi How to convert below code like - CREATE PROCEDURE [dbo].[GetData] ( @Parameter1 varchar(256), @Parameter2 varchar(256), @Parameter3 int = null ) AS BEGIN SET NOCOUNT ON; DECLARE @BaseQuery nvarchar(max) = N'SELECT T.* FROM dbo.Table1 AS T' , @ParamList nvarchar(max) = N'@p1 varchar(256), @p2 varchar(256), @p3 int' , @WhereClause nvarchar(max) = ' WHERE 1=1'; IF @Parameter1 […]
where clause - Hi I have below parameters . @frDate date, @toDate date, @VName nvarchar(100) = null, @CName nvarchar(100) = null, I want if user has entered nothing in VName and Cname then where should be between @frDate and @ Todate If user has entered Vname & Dates then all records with date range and Vname = @ […]
Case Statement in where - Hi Is it possible to do like this @ItemGroup is a parameter Select Itemcode,Itemname,ItemGroup from tbl1 Case when @ItemGroup is null then where itemgroup is null else where itemgroup is not null end Thanks
case statement - Hi In below line i want if when > 0 instead of 0 then what should i change (Select Case (select count(*) from tbl1 T where T.num = T0.num ) when 0 then Thanks
Invalid column Name Hcode - Hi   (Select Case (select count(*) from tbl1 T where T.num = T0.num ) when 0 then HCode=STUFF ( ( SELECT ', '+ CAST(A0.[aCode] AS VARCHAR(MAX)) FROM O A0 INNER JOIN I A1 ON A0.[AEntry] = A1.[SEntry] FOR XMl PATH('') ),1,1,'' ) else '2' end)   from tbl5 t0   Thanks
SQL Server 2012 - T-SQL
Grouping by hour and minute from TimeStamped data - TSQL is not my daily language and I could use a hand figutring this one out. I have date that I'd like to report on that shows the number of processes that start every 10 minutes for a given day of the week. The data consists of 6 years worth. I'd like to pull reports […]
SQL Server 2019 - Administration
Applying SQL Server 2019 CU 14 cause's master database corruption - I've just recently applied the SQL Server 2019 CU14 to two of our testing servers with no problem. Then when applying this CU to our staging environment the install failed and left me with a corrupted Master Database which meant the SQL Server Service wouldn't start and luckily I had a Master database backup to […]
SQL Server 2019 - Development
Slow Query On SQL 2019 - Hi all,   I have a problem with this query: SELECT top 10 (total_elapsed_time/execution_count)/1000 AS 'AVGEXETIME', 'AverageIO' = (total_logical_reads + total_logical_writes) / qs.execution_count, 'TotalIO' = (total_logical_reads + total_logical_writes), 'Executioncount' = qs.execution_count, 'IndividualQuery' = SUBSTRING (qt.text,(qs.statement_start_offset/2)+1, ((CASE WHEN qs.statement_end_offset = -1 THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2 ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1) ,'ParentQuery' = qt.text,'DatabaseName' = COALESCE(DB_NAME(qt.dbid),DB_NAME(CAST(pa.value […]
SSRS 2012
SSRS reports - Hi All, I need to delete multiple SSRS reports from report portal. Is there any way to delete them using either rs.exe or any other utilites you might know of? Thank you
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -