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

Learning from Exercise

Editor: This editorial was originally published on Nov 12, 2019. It is being republished as Steve is on vacation.

A long time ago I decided to run every day. I did for a bit, in fact, I had a neat milestone along the way and continued on for 1564 days. That was quite a memorable period in my life, and one that I look back upon fondly. I've aged a bit, and while I could do it again, I also have decided there are other things that matter more to me, so I have moved on in life.  I learned a lot from that time, lessons about myself and life that continue to help me today. Some of them even apply to work and my career, little nuggets of wisdom that help me find ways to find success in my life.

Apart from some better fitness, one of the main benefits for me was the sense of accomplishment. I had no bad days where I would think I wished I had run. None. That seems obvious, but it also provided me some comfort that I had moved things forward in my life. I took that lesson back to work, where I sometimes have bad days. I have days where nothing goes right, or I have people that take over my day and schedule.

I know there are also a number of things that I need to do at work, which aren't that important, or even aren't that critical, but they provide a measure of satisfaction that I've moved things forward. These days that is often getting things scheduled for the newsletter. In the past it might be doing a little space extrapolation (though I'd just look at this in SQL Monitor today). Low value items, but I get some accomplishment in the midst of otherwise stressful times when I get something small done that is on my list.

The other thing that came from the running streak was the feeling of getting away from other parts of my life. Whether with family or work, I might be overwhelmed or stressed or otherwise out of sorts in my day. Taking 20-30 minutes for myself was a way of resetting my day, and it was a welcome break. While exercise is my thing, and even today it's a priority around work, I've had other crutches that help me cope. I love to read, so taking 5 minutes to escape in a book every day is something that feels similar to exercise.

I know other friends that might play a short game, play with a pet. Having some other consistent, distracting activity is a good release when things are tough. No matter how busy we are, or what's broken, taking 5, 10, 15 minutes away can help refresh you and get you ready to go back into the trenches and deal with others.

I'm sure jobs exist that can't spare the time, but I've never had one. I haven't always realized it until later, but I wish someone had told me to take 10 minutes away in a crisis to reset myself and then come back. I know I'll remember that the next time I end up being stressed during an IT problem at work.

Steve Jones - SSC Editor

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

 
 Featured Contents
SQLServerCentral Article

Combining Silver Tables into a Model – Data Engineering with Fabric

John Miner from SQLServerCentral

This next article in the series creates objects at the gold layer for consumption by combining tables from the silver layer of the lake house.

External Article

Building a Culture of Data: The Technical Aspects

Additional Articles from SimpleTalk

In the first part of this two-part series, I covered the mostly non-technical aspects of building a data culture. While the lion’s share of the work will be getting people to work together and embrace ever deeper use of data, as a reader of Simple-Talk, a lot of this transition will be technical.

Blog Post

From the SQL Server Central Blogs - Microsoft Fabric shortcuts

James Serra from James Serra's Blog

I talked about Microsoft Fabric shortcuts in my blog post Microsoft Fabric – the great unifier (where I have updated the picture with the newest supported sources) and wanted...

Blog Post

From the SQL Server Central Blogs - Will AI Replace SQL Developers? The Answer Might Surprise You!

Tracy McKibben from RealSQLGuy - Helping You To Become A SQL Hero

The world of databases keeps growing, and the pressure to extract meaningful insights from that data increases just as fast. If you work with data, you know that SQL...

Deciphering Data Architectures

Deciphering Data Architectures

Additional Articles from SQLServerCentral

Data fabric, data lakehouse, and data mesh have recently appeared as viable alternatives to the modern data warehouse. These new architectures have solid benefits, but they're also surrounded by a lot of hyperbole and confusion. This practical book provides a guided tour of these architectures to help data professionals understand the pros and cons of each.

 

 Question of the Day

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

 

Full Text Editions

In which editions can I use Full-Text and semantic search?

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)

The Query Traceflag

Answer:

Explanation:

Discuss this question and answer on the forums

 

Featured Script

Truncate tables where Referential Integrity exists

Perry Whittle from SQLServerCentral

This script can be useful in test and dev environments to quickly clear tables via the truncate command where referential integrity exists.

--=====================================================================================--
--=== Author: Perry D J Whittle ===--
--=== Date: 13/07/2023 ===--
--=== Synopsis This script will generate drop and create statements for all FK ===--
--=== constraints in the selected database. This will provide the ability ===--
--=== to truncate any tables rather than run delete statements which will ===--
--=== take some time on large tables. ===--
--=== ===--
--=== Changelog: ===--
--=== PDJW V1.0 09/03/2023 Initial script creation ===--
--=== PDJW V1.5 17/07/2023 Script did not cater for composite FKs so added ===--
--=== PDJW V1.7 25/07/2023 Tidy up the composite key script detail ===--
--=== PDJW V1.8 22/03/2024 Further tidy up the composite key detail ===--
--=====================================================================================--

--============================================================--
--=== Execute under the context of the db you're working on ===--
--============================================================--
--USE [somedb]
--GO

--==========================--
--=== Suppress rowcounts ===--
--==========================--
SET NOCOUNT ON

--==========================================--
--=== Gen the drop constraint statements ===--
--==========================================--
PRINT '--!!! The following statements run first to remove the referential integrity !!!--'
SELECT 'ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + ' DROP CONSTRAINT ' + QUOTENAME(name) + ';' + CHAR(13)
FROM sys.foreign_keys
ORDER BY QUOTENAME(OBJECT_NAME(parent_object_id))

--================================--
--=== Now truncate your tables ===--
--================================--
PRINT CHAR(10) + '--!!! Now truncate your tables before continuing !!!--' + CHAR(10) + CHAR(13)

--============================================--
--=== Gen the create constraint statements ===--
--============================================--
PRINT '--!!! The following statements run last to restore the referential integrity !!!--'
SELECT
'ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(fk_tab.schema_id)) + '.' + QUOTENAME(fk_tab.name) + ' WITH CHECK ADD CONSTRAINT ' + QUOTENAME(fk.name) +
' FOREIGN KEY(' +
STUFF((SELECT ', ' + QUOTENAME(c2.name)
FROM sys.foreign_key_columns fkc2
INNER JOIN sys.columns c2 ON fkc2.parent_object_id=c2.object_id
AND fkc2.parent_column_id=c2.column_id
WHERE fkc2.parent_object_id = fk_tab.object_id
GROUP BY c2.name
FOR XML PATH(N''), TYPE).value(N'.[1]', N'NVARCHAR(MAX)'), 1, 2, N'')
+ ')
REFERENCES ' + QUOTENAME(SCHEMA_NAME(pk_tab.schema_id)) + '.' + QUOTENAME(pk_tab.name) +
' (' +
STUFF((SELECT ', ' + QUOTENAME(c3.name)
FROM sys.foreign_key_columns fkc3
INNER JOIN sys.columns c3 ON fkc3.referenced_object_id=c3.object_id
AND fkc3.referenced_column_id=c3.column_id
WHERE fkc3.referenced_object_id = pk_tab.object_id
GROUP BY c3.name
FOR XML PATH(N''), TYPE).value(N'.[1]', N'NVARCHAR(MAX)'), 1, 2, N'')
+ ')
GO
ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(fk.schema_id)) + '.' + QUOTENAME(fk_tab.name) + ' CHECK CONSTRAINT ' + QUOTENAME(fk.name) + '
GO' + CHAR(13)
FROM sys.foreign_keys fk
INNER JOIN sys.tables fk_tab on fk.parent_object_id=fk_tab.object_id
INNER JOIN sys.tables pk_tab on fk.referenced_object_id=pk_tab.object_id
ORDER BY fk_tab.name

More »

 

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 2019 - Administration
The OS returned the error '(null)' while attempting 'DeleteFile' filestream.hdr - I have a SQL Server 2019 Enterprise Edition on CU 25. It has in-memory oltp enabled. I have a full and a diff backup I'm trying to restore under a new database name, followed by some log files. The full restores fine but then the diff  throws this error and I can't find anything about […]
SSRS Web Service URL - getting rid of HTTP - Not sure if this is the place to ask, but will give it a shot. We have an instance of SSRS 2019 running, and we connect to it via our Dynamics CRM (online version) - in this case via an IFRAME within a form.  The report works, the issue is that some of the images […]
SQL Server software and windows version compatibility level - Is there a specific platform or website where I can verify the compatibility between different versions of SQL Server software and Windows? For instance, I would like to check the compatibility of Microsoft Command Line Utilities for SQL Server, MS Report Builder, and MS SQL Server Management Studio.
can I monitor auto stats updates through extended events? - We have pretty big tables very sensitive to stats with many updates. Our systems are complex with many places requiring explicit statistics updates and we want to monitor this to investigate potential SAMPLE updates overwriting FULLSCAN updates. We managed to catch all such updates through extended events by filtering on sp_statement_starting and sql_statement_starting but we […]
Access Issues - We have a windows account that currently has access to half of the sql server machines.(Both RDP and SQLAccess) The rest of the servers we do not have both RDP and SQLAccess. Does this mean when our accounts were created in AD we were not assigned to all relevant security groups which allows us to […]
SQL Server 2019 - Development
timeout in vs for ssas tabular deploy is 0 but i still timeout deploying - hi we run 2019 std but i'm testing this on 2016.   following some old notes and starting from the debug tab in vs, i picked options, went to bi developer and set the properties you see below.  but i still get a timeout on each line of the process when deploying as shown in the […]
Table variable declared within cursor persists across loop iterations - If you run this code it creates a 2 row cursor loop.  Within the cursor the temp table @spec is declared and inserted into (as the output of a select).  What was unexpected for me is in the second iteration of the loop the temp table contains 2 rows.  The "solution" to this issue I'm […]
Blocking question - Hi all, We have a SSIS package that does 2 things in parallel: moves data from one partition to another within the same table. First, it truncates destination partition, then selects from source partition and inserts to destination one. But my select process is blocking truncate process, and truncate in turn is blocking insert to […]
SQL Azure - Development
Performance - Experts, I am learning some skills so I can troubleshoot some performance-related issues. I have gotten good with some basics but when it comes to query which gets the data from tens of tables, I get lost, especially when I look at the execution plan. I am hoping if someone would give me some tips […]
SQL Azure - Administration
Looking for a Recommended Azure SQL Managed Instance Book - Can anyone recommend an Azure SQL Managed Instance book? I'm looking for information about "care and feeding," best practices, etc.
Powershell
Use of variable issue - All, I'm trying to set up some code in a SQL agent job. The following code works as expected: $sqlConn = New-Object System.Data.SqlClient.SqlConnection $sqlConn.ConnectionString = "" $sqlcommand = $sqlConn.CreateCommand() $sqlcommand.CommandText="Select filename from dbo.ssisfiles" $DataAdapter = new-object System.Data.SqlClient.SqlDataAdapter $SqlCommand $dataset = new-object System.Data.Dataset $DataAdapter.Fill($dataset) foreach ($Row in $dataset.Tables[0].Rows) { if (Test-Path -Path "c:\as_demo.txt") { Throw "File […]
MySQL
How to install mysql-connector-python-8.4.0.zip it does not have setup.py - How to install mysql-connector-python-8.4.0.zip it does not have setup.py. Checked also: mysql-connector-python-8.4.0.tar.gz
SQL Server 2022 - Administration
when primary is down and not accessible failover not occured then how to recover - HI All, can any one reply on this when primary is down and not accessible also failover not occurred to secondary and size of the database is huge client dont want to loos the data and how to recover always on in secondary server online with out data loss
SQL Server 2022 - Development
Multiple processes accessing the same table. some to write others to read / Lock - Dears, Hope this message finds you well We have a log table which is used at same time by some processed to read and others to write. This is causing deadlock What can we do to secure that we end up with deadlocks? Shall we shift the isolation level on the read queries or something […]
SSIS upgrade - I have about 40 packages that are dtsx files that were created with SQL 2016. It appears that I need to either install SNAC (which is decprecated / not recommended) or change them all to sql ole db.  Is there an easy way to change to sql ole db?    
 

 

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

 

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