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

Daily Coping Tip

Find a way to craft what you are doing to give it more meaning

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.

Writing Before Reading

Coding is one of the few (or maybe only) places where we learn to write a language before we learn to read it. Many of us get started in some way by working through exercises, looking at very small snippets of code and then starting to write our own. Perhaps that's because we experiment by changing the behavior of the computer, which naturally takes some writing work on our part.

Perhaps we can do better, and should to better. Perhaps we would become less susceptible to the Not Invented Here (NIH) stance that so many developers seem to take. Not with major projects, but often with small sections of code or libraries, preferring to structure something new than re-used (and take the time to understand) what's already there.

This isn't to imply that most developers need to write their own code or don't work to understand others, but often they prefer to rebuild something in a way that is more familiar. It's a form of the Mere-exposure effect, and it sometimes leads developers to prefer certain patterns, tools, platforms, and more. Perhaps it's the opposite of the shiny ball syndrome, which leads people to chase the newest thing available in their area.

I know there are plenty of developers that copy and paste code from the Internet as well, which might seem to be a way of getting around NIH syndrome, but I think many people do this when they find code that solves a problem. Even if they don't understand how it works, they'll seek to reapply that same code to a new problem.

I do think reading code is hard. In some sense, it sucks. I'd often prefer to understand the basic inputs and outputs, perhaps rewriting the code to work in a way that's more comfortable for me to understand. Maybe I better understand my own code, maybe I'm falling victim to the IKEA effect (I'd rather depend on my own software than someone else's), or maybe I'm just being lazy.

There are plenty of articles on how to read other people's code, and I am trying to get better at this. I do try to debug and reason out how queries are written that solve problems in the forums. I may break apart queries and try to understand how someone has used a window function or a CROSS APPLY in a certain way. It helps build my skills, but it also helps me learn to better read other people's code and perhaps carry that skill into the future.

Steve Jones - SSC Editor

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

 
 Featured Contents

The IDENTITY Column Property

Br. Kenneth Igiri from SQLServerCentral

There are a number of ways to generate key values in SQL Server tables including the IDENTITY column property, the NEWID() function and more recently, SEQUENCES. The IDENTITY column property is the earliest of these methods. It was introduced very early in the history of SQL Server and it is arguably the simplest approach. Though old, IDENTITY is still maintained in modern versions of SQL Server and is still relevant for simple use cases.

SQL Server 2019 in Containers

Steve Jones - SSC Editor from SQLServerCentral

SQL Server 2019 in containers are a fast way to get started with SQL Server 2019, and can be used throughout your data estate from development to production.

Install SQL Server from Configuration File with Installation Center

Steve Jones - SSC Editor from SQLServerCentral

Learn how to build a SQL Server Configuration file from the Installation Center and then use this configuration file for subsequent installations.

From the SQL Server Central Blogs - EightKB – Schedule published

dbafromthecold@gmail.com from The DBA Who Came In From The Cold

Today we announced the schedule for EightKB EightKB was setup by Anthony Nocentino (b|t), Mark Wilkinson (b|t), and myself as we wanted to put on an event that delved...

From the SQL Server Central Blogs - May the forced be with you?

Daniel Janik from Confessions of a Microsoft Addict

Today is May the fourth and I’ll start by saying: Happy Star Wars day to all. Since it is May the fourth I figured a Star Wars themed post...

 

 Question of the Day

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

 

XEvent Actions

What is an action in Extended Events (XEvents)?

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)

Describe One Column

I have this dataframe in Python:

sales.head()
DateDayMonthYearCustomer_AgeAge_GroupCustomer_GenderCountryStateProduct_CategorySub_CategoryProductOrder_QuantityUnit_CostUnit_PriceProfitCostRevenue
02013-11-2626November201319Youth (<25)MCanadaBritish ColumbiaAccessoriesBike RacksHitch Rack - 4-Bike845120590360950
12015-11-2626November201519Youth (<25)MCanadaBritish ColumbiaAccessoriesBike RacksHitch Rack - 4-Bike845120590360950
22014-03-2323March201449Adults (35-64)MAustraliaNew South WalesAccessoriesBike RacksHitch Rack - 4-Bike2345120136610352401
32016-03-2323March201649Adults (35-64)MAustraliaNew South WalesAccessoriesBike RacksHitch Rack - 4-Bike204512011889002088
42014-05-1515May201447Adults (35-64)FAustraliaNew South WalesAccessoriesBike RacksHitch Rack - 4-Bike445120238180418

I want to get some statistical analysis on just the Unit_Cost column with the count, mean,min, max, etc. How should I do this?

Answer: sales['Unit_Cost'].describe()

Explanation: By selecting one column from the data frame with bracket notation, you can then apply the describe() method to this one column, as shown here:

sales['Unit_Cost'].describe()

Ref: pandas.DataFrame.describe - https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.describe.html

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 - Administration
Support removing a RID lookup | Different execution plan between environments - Hey all, We've made some optimization to this view and the indexing. Actually had it running quite well as of the last several weeks. As of these past couple days, the query is taking far too long to return a full data set. I can do a select * from my local 2017 instance, in […]
SQL Server 2016 - Administration
Always on automatic fail-over SQL 2016 Standard edition supports it ? - quick question? Always on SQL WSFC configuration , automatic fail-over SQL 2016 Standard edition supports it ? I know enterprise supports it.
SQL Server 2016 - Development and T-SQL
Strange Attachment Corruption for Database Mail - I wrote a SPROC to email some data. CSV file, single data string column. Between 100KB and 5MB in size Started with a Query Attachment. Opened attachment from the email and saw that after a few thousand rows, the data corrupted. Next I tried using BCP to create the file, then get Database Mail to […]
Administration - SQL Server 2014
CMEMTHREAD Waits - There seems to be very little information around this wait type, besides the basic description, there's almost nothing about what actually causes it, and what can be done to resolve/reduce it. The server is SQL Server 2014 SP3 CU4, Enterprise Edition, and has 32 cores (possibly hyperthreaded, but I think not) and 265GB RAM, and […]
Number of TempDB Files over 8 - OK, before everyone jumps on me and tells me this is settled... I have a client where the application vendor and SQL System Admin are insisting that having more than 8 TempDB files is recommended. In the DBAs words "Microsoft recommend up to 8 unless you make heavy use of TempDB". Well they have […]
Development - SQL Server 2014
Import a text file into SQL Server table without BULK insert due to special char - We currently have a process to import a text file from a customer that uses BULK insert but it is now crashing due to special characters (Ñ, Ã). , in the file.  Is there another way to get the text file into  a table  without  BULK  insert/BCP  since  this  runs  in  a nightly  batch  process?  […]
SQL 2012 - General
T-sql Syntax help needed - Question: I want to create a sequential rank. Run the code and you will understand what I mean. I need baby5 and baby6 get a 2  and so on. The idea is  if we have 8 people with 1oo score all of them get a 1 Then the 2 folks with 98 get a 2 […]
SQL Server 2019 - Administration
Table, Stored Proc, DB Last Used Date? - Has it become any easier in recent releases to see when a table, stored procedure, database was last used ? I have been working on the IMBi recently, and each object has a Last Used date in the description, so it's just a couple of clicks to get the information. We have SQL 2019 on […]
Looking for the cmd to Recompile ALL procs across ALL DBs on a single SQL Server - This command will update ALL stats on ALL DBs on a single SQL Server: exec sp_MSForEachDB 'use ?; if DB_ID(''?'') > 4 exec sp_updatestats;' I'm looking for a similar, powerful command to RECOMPILE ALL procs across ALL DB's on a single SQL Server.  I know this cmd recompiles ALL procs for 1 DB: USE [myDatabase]; […]
SQL Server 2019 - Development
2 questions - Hi Eeveryone. I have a pretty simple test to do, just want to make sure i got it right! Attaching the test with my results, please confirm that i have it correctly! THANK YOU!     Given you have 2 tables Students: contain the details for the student in the University StudentID StudentName StudentStatus Registrations: […]
SQL Server 2008 - General
OVER() and NULL values - The column [hrsfacil] contains many NULL values, still the sum of [hrsfacil] is correct using the OVER clause. Why don't I need to use ISNULL(hrsfacil,0) ? Cheers, Julian SUM([hrsfacil]) OVER() AS Facil
Powershell
Cleanup Sysmail -items from msdb - I took over a SQL instance that never did a cleanup of MSDB. The SysmailItems has close to 25gig of space used storing old email attachments. I know there is a system SP that does a cleanup using begin date \end date. I was looking for a wrapper using PS that would delete 10,000 records […]
Security and Auditing
Audit who (account) stopped or started SQL services (Agent/MSSQL) - Dears, The only way I've found up until today is to audit this externally on Windows level. But I'd like to do this within SQL. I cannot find anything in the default trace that explains who did it, nor in the sql errorlog. So I'm a bit stuck here; Anybody ever set this up? Thanks, […]
SQLServerCentral.com Website Issues
Lack Of User Options - If there are any settings or options a user can make to the forums I can't find them. If there are and I'm just not seeing them please point out how to access them. I'm looking for options that allow those with visual issues to change things like color and contrast to make it easier […]
COVID-19 Pandemic
Daily Coping 13 May 2020 - Today’s tip is to be grateful for the little things, even in difficult times. My thoughts: http://voiceofthedba.com/2020/05/13/daily-coping-13-may-2020/
 

 

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

 

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