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

Daily Coping Tip

Focus on being kind rather than right

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.

Will You Touch a Server Again?

I ran across a round table on the future of the data center. While plenty of my clients have data centers, lots are also looking to cloud vendors for hosting services. Often this is for new services, but plenty of them are migrating their workloads to cloud systems. I've also been surprised by how often I've seen this happening the last couple of years.

For much of the last 15 years of my career, I didn't touch a physical server in any way. I'm not sure I even saw any of them. I didn't touch a keyboard or view a monitor directly connected to a machine, and I haven't had to build or replace hardware in a server class machine in any system since I started working for Redgate. Even before that, most of my work with any sort of server was for SQL Server Central only.

Today, I wonder if any of you think you might have to build, upgrade, or even work directly, on a server class machine in your career. Certainly the smaller the organization, the more likely it is that you need to do so, but in many small companies, the agility and flexibility of the cloud might lead you to those services.

I doubt that I would need to work on a production machine, but I do think I could end up dealing with test and dev servers if I were to change jobs. I'm not looking to do so, but I also think that for many of the customers I deal with, they are better off using local resources for test and development, even outside of the individual laptops and workstations.

I'd be happy to never need to touch a physical server again. While I have gotten used to rebuilding my own desktops, that's more a side challenge, and since I can work on a laptop for a few days, I'm only inconveniencing myself. Having others depend on my hardware skills is not something I want to experience.

Steve Jones - SSC Editor

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

 
 Featured Contents

Stairway to Snowflake Level 1 - An Introduction to Snowflake

Reeves Smith from SQLServerCentral

Get an overview of Snowflake in this level, one of the fastest growing data warehouse platforms in the world.

SQL Server SET STATISTICS IO ON Deep Dive

Additional Articles from MSSQLTips.com

In this article we look at how to interpret and use the results of STATISTICS IO when tuning SQL Server queries.

Product Training Sessions from Redgate University

Additional Articles from Redgate

In 2020 Redgate introduced a series of live training sessions on a selection of their most popular tools, offering customers top tips and demonstrations of new features. If you didn't get a chance to join then check out the recordings available here and be sure to subscribe for news about upcoming sessions.

From the SQL Server Central Blogs - Reminder: SQL Server Agent and the clocks going forward

matthew.mcgiffen 73574 from Matthew McGiffen DBA

For most of us in the Northern Hemisphere the clocks go foward next month and we get to look forward to longer, sunnier evenings. This post is a reminder...

From the SQL Server Central Blogs - Query DB2 From PowerShell

Aaron Nelson from SQLvariant

Story time: A few months ago I was in a meeting where we were all asked how we could take on a complex, but very necessary task. As they...

 

 Question of the Day

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

 

An R Loop

What does this loop do in R?
x <- 1:20
for (val in x) { 
 if ((val %% 2) == 0) {next}
 print(val)
}

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)

Finding the last month's values

I have some data in a table, which looks like this:

saleyear salemonth currMonthSales
2020     11        525.00
2020     12        1610.00
2021     1         900.00

I want to get these sales for the month, along with the prev month sales, in each row. I have this query:

SELECT 
       ms.saleyear
     , ms.salemonth
     , ms.currMonthSales
     , xxxxx AS prevsales
FROM   dbo.MonthSales AS ms
ORDER BY ms.saleyear DESC, ms.salemonth desc;

What should replace xxxxx in the query?

Answer: LAG (ms.currMonthSales) OVER (ORDER BY ms.saleyear, ms.salemonth)

Explanation: The LAG function will give you the value from the previous row. Since the query is using a descending order, we need the ORDER BY in LAG to be ascending to get the right data. Ref: LAG - https://docs.microsoft.com/en-us/sql/t-sql/functions/lag-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 2016 - Administration
Connection options to encrypted servers. - I've applied certificates and enforced encryption on two SQL 2016 SP2 servers. Using the same login credentials I can create an encrypted connection to one of the servers by selecting 'encrypt connection' in the connections options. With the second server unless I also select 'trust server certificate' I get a connection error: A connection was […]
Disable Download button SSRS2016 (RC3) ?. - Hello, I'm testing the Reporting Server 2016 RC3 in the top row of the page http://server /reports you see right of the settings button , the Download button. ( see attachment ) Is it possible to disable this download button?   thanks jackyjoy
SQL Server 2016 - Development and T-SQL
Parsing an XML field within a table - I am trying to parse a field that is XML in a table and insert into a table. Where would be a good example to do this> I have attached the values from that field in a notepad++ file.
Sequencing query - Hello,   I have a query regarding the best way to deal with a sequencing problem.   This may be a little hard to explain. I have the following data (table and data script attached) where I need to regroup the depths columns by 1 foot increments and join the corresponding data which falls within […]
Debugging with VS setting breakpoints - Ok i under stand how to debug with VS, my Question is this. I have an update statement which fires a trigger which in turn fires a stored proc which in turn fires more store procs.... (I did not right this process it was done by a third party.) The question is i have a […]
Administration - SQL Server 2014
removing database from AG and putting it back in - Lets say a database was removed from AG for maintenance purpose. The primary node would have the w/r copy of it and secondary would have it in restoring state. What would be the best way to put it back in the AG again after maintenance? From primary --> add to AG and then join?
Development - SQL Server 2014
get Actual backup file name from the sql backup path - Hey everyone, sorry, i am trying to get the actual file name accurately from the path, what i currently have is: E:\Backup\Server1\Database1\Database1_131983519013.bak and want to get just: Database1_131983519013.bak trying to use trim or left etc. but finding it difficult as some other database names might be longer or shorter, so its random, any idea how […]
SQL Server 2019 - Administration
SQL server for an oracle developer/dba - I have a few years experience developing with oracle and have now moved to a place where they use SQL server (2005). Where would be a good place to learn things like SQL Server query optimization, basic dba stuff and sql server gotchas for someone with my background.
HA solution using mixed SQL Server on-prem and Azure SQL Server - trying to come up with an architecture for HA.  I was thinking of using our on-prem SQL Server as primary, with Azure as secondaries.  IT has mandated that putting everything in Azure is too costly, and we wanted to come up with a geo-replicated solution as our customers are all over the place.  Does anyone […]
Retrieve data from First 25 and last 25 data pages from the Database - I have received a very strange and unusual request from one of our departments to provide them the data for first 25 and last 25 pages of the database since they would like to copyright that data. My argument is that database is made up of multiple objects like tables, stored procedures, functions etc which […]
SQL Server 2019 - Development
Server is fast, then slow, then fast with no pattern - I am having a problem with my sql server running queries and using it in Visual Basic.  The primary table I pull data from has 24 columns with 76,000 rows.  Sometimes it takes less than 6 seconds to run the query.  Other times, it takes over two minutes and once in a while, it stops […]
Reporting Services
Add more space below report totals - Hello, First off I am sorry if I'm posting this in the wrong area. I hope I'm not I've search endlessly to try and find this answer. Even on here. Probably using the wrong words. How can I add more space below the bottom of my reports. When I run the report, I need […]
Integration Services
save mutiple ssrs reports from a ForEach loop into a single file - Hello, I have a client who has a letter run that is produced monthly using a combination of SSIS and SSRS. In short, a foreach loop passes the parameter intothe ssrs report and usinga C# script task generates a PDF into a windows folder. They are asking if I can alter the process so that […]
Design Ideas and Questions
SQL newbie, question about primary key. - Hello, SQL newbie here. I've got a question about the proper use of primary keys, hoping someone can help out. Let's say I establish an HR database and decide that, since Social Security numbers are unique and non-repeating, I'm gong to use SS numbers as my primary key. Something like this: Name, Title,  Social_Security_Number Joe […]
The Future of Community
Is there room for independent SQL or Data Integration based User Groups? - So I live in a smaller community with no real User Group presence of any kind, and though when SQL Saturday events were still in person the nearest one near me is 2 hours drive.  Now during pandemic I doubt we'll see any return anytime soon, so I was wondering if there's room to try […]
 

 

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

 

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