SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

The Voice of the DBA

Merry Christmas 2018

It's Christmas Day, and a Merry Christmas and Happy Holidays to everyone out there.

I sincerely hope none of you are reading this today and you are getting a well deserved break from work, but I'm sure a few of you are checking email. I'm also sure a very few of you have to work on this day, for one reason or another. Hopefully things aren't broken and that your organization compensates you for this day.

I'm taking the break with family, enjoying time at home. A quiet Christmas for us, perhaps with some hiking or at least a few hours at the dog part, but mostly some games and fun. Chores, of course, because all the animals need to eat and there are lots of horses at the ranch.

Tomorrow, it's back to work, but for now, my best wishes to you all.

Steve Jones from SQLServerCentral.com

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

ADVERTISEMENT
SQL Source Control

How to track every change to your SQL Server database

See who’s changing your database, alongside affected objects, date, time, and reason for the change with SQL Source Control. Get a full change history in your source control system. Learn more

SQL Change Automation

CI/CD  for your SQL Server database

Feeling the pain of managing and deploying database changes manually? Redgate SQL Change Automation completes your database delivery process by building, testing, and deploying the database changes you and your team check into version control.  
Try it free

Featured Contents

 

The Bones of SQL - The Holiday Table

Bob Hovious from SQLServerCentral.com

This second part to a previous article on Calendar table generation shows how to create a holiday table containing both fixed-date and variable-date holidays. More »


 

The Data Catalog comes of Age

Nowadays, it isn’t just banks and multinational corporations who have to be rigorous about data. Even modest organisations who would previously been unable to afford the storage, tooling and processing power required, now have sophisticated data processing capabilities within their reach. More »


 

SQL Server 2019 Community Technical Preview (CTP) 2.1 is Available Now

Additional Articles from Database Journal

Microsoft announced the release or CTP 2.1 for SQL Server 2019. This is the second CTP released for SQL Server 2019, and it has lots of new exciting features, like " UDF inlining". Read on to find out more! More »


 

From the SQLServerCentral Blogs - Advent of Code 2018 – Day 4 (Repose Record)

Wayne Sheffield from SQLServerCentral Blogs

Advent of Code 2018 – Day 4 As I explained in a recent post, I’m participating in this year’s Advent of Code... More »


 

From the SQLServerCentral Blogs - Capture the Flag – The Trace Flag

Jason Brimhall from SQLServerCentral Blogs

Many people work in a tightly controlled environment. Every change requires a change control form and approval to make a... More »

Question of the Day

Today's Question (by Steve Jones):

The Christmas Price Index measures the current cost of the gifts from the 12 Days of Christmas. Currently this is  an amazing $39,094.93, up 1.2% from last year. What is the most expensive gift on the list?

Think you know the answer? Click here, and find out if you are right.


We keep track of your score to give you bragging rights against your peers.
This question is worth 7 points in this category: humor.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

ADVERTISEMENT

The Phoenix Project: A Novel about IT, DevOps, and Helping Your Business Win

The company's new IT initiative, code named Phoenix Project, is critical to the future of Parts Unlimited, but the project is massively over budget and very late. The CEO wants Bill to report directly to him and fix the mess in ninety days or else Bill's entire department will be outsourced.  Get your copy from Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

I have a data set of Christmas tree purchases by year and source location. The data is in three columns, with a sample shown below:

 PurchaseYear PurchaseSource PurchasePercent 2006 Farm 29 2007 Nursery 21 2008 Chain Store 31 2009 Retail Lot 32 2010 Farm 33

I want to get the changes in percentages purchases from year to year, but only among each source type. What should I add to my query below in the space where there is "xxx"?

 SELECT ctp.PurchaseYear, ctp.PurchaseSource , ctp.PurchasePercent - xxx AS PurchaseChange FROM dbo.ChrismasTreePurchases AS ctp WHERE ctp.PurchaseYear > 2006 ORDER BY PurchaseChange DESC 

Answer: LAG(ctp.PurchasePercent, 1) OVER (PARTITION BY ctp.PurchaseSource ORDER BY ctp.PurchaseYear)

Explanation:

The LAG function will get me the previous row's value, based on the OVER() clause. A LAG must have an ORDER BY, so the last choice is incorrect. I want to get the year over year purchase growth by type, so I partition by source and order by years.

Ref: LAG - click here


» 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 : SQL Server 2017 - Administration

SSMS Login Issue - I was assigned a new user and was able to rdp to server but unable to get in SSMS.  Is it...

SSIS DB Migration Issue from 2012 to 2017 - Hi all, I'm hoping someone can help me. A few weeks ago I replaced a SQL 2012 Server with a brand...


SQL Server 2017 : SQL Server 2017 - Development

INSERT STATMENT Performance CONVERT_IMPLICT - In the following test query first INSERT statment execution plan shows implicit conversion for  values but the second one does...

SQL Query Modification Help Request PT4 - Hello Community The following SQL Script will compare TablesA and TableB for a match in column columns A & B and if...


SQL Server 2016 : SQL Server 2016 - Administration

Queries to practice compilation and recompilation. - Hi expert, Can someone please post here some quires (or simulate recompilation) to practice compilation/recompilation? I would really appreciate.  Thanks,


SQL Server 2016 : SQL Server 2016 - Development and T-SQL

Help with creating a parameterized Stored Procedure which takes Server Name, DB Name and Table Name and gets metadata from information_schema - Hello All, I needed help with the below query. I was trying to create a parameterized proc that takes Server Name, DB...

Sample TSQL , SSIS , SSRS projects - Hi Guys, Where can I get sample projects TSQL , SSIS , SSRS projects. that I can provide for students? Thanks

Parent/Child - where I am standing - In parent child, I want to pass EmployeeId and get the list of all parents from tree till given EmployeeId...

Validate date stored as a string as a complete, valid date - I have an upstream table where birth_date is stored as a string, YYYYMMMDD.  The data is very dirty.  I need...


SQL Server 2012 : SQL 2012 - General

HammerDB results - I've created a new SQL server VM at work, and decided to run some benchmarks on it.  HammerDB reports around...

Import Data From Caché To SQL Server 2012 - Does anyone know what is the fastest method to import data from intersystems Caché to SQL Server? I am testing...


SQL Server 2012 : SQL Server 2012 - T-SQL

Can you help me on this? - 1) In my table i have two columns i.e Name and marks,if i do aggregation on those two tables... what...


SQL Server 2008 : SQL Server 2008 - General

Output File Cleanup reported: Unable to open Step output file - Dear All, I keep getting the following error message:  Output File Cleanup reported: Unable to open Step output file even though I...


Reporting Services : SSRS 2012

Can you help me on this? - 1) In my table i have two columns i.e Name and marks,if i do aggregation on those two tables... what...


Reporting Services : SSRS 2016

Expanding Columns in SSRS Report - Hey, I am having one requirement pertinent to expand and hide columns based on click of  plus sign in column header...


Data Warehousing : Integration Services

Can you help me on this? - 1) In my table i have two columns i.e Name and marks,if i do aggregation on those two tables... what...

Parsing Nested XML file - Hi ,  can someone please help me in getting the simple method of parsing the XML file in SSIS. I was...


SQLServerCentral.com : Articles Requested

Article Review - If you are willing to review articles for others, leave a note here and others can PM you articles. Leave a...

This email has been sent to [email protected]. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the [email protected].
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: [email protected]