About a belle

Who am I?
– Donabel Santos
– SQL Server MVP :)
– Senior SQL Server Developer/DBA/Trainer at QueryWorks Solutions
– Instructor at  British Columbia Institute of Technology (BCIT) School of Computing and Academic Studies. Currently teaching database courses – SQL Server Administration/Development/Business Intelligence, MySQL. Used to teach Web Development courses too, and created materials for SharePoint End Users and SharePoint Designer courses.
– SQL Server Business Intelligence Analyst/Developer at the University of British Columbia (UBC)
– MySQL Core, MySQL Professional
MCP, MCTS, MCITP-Developer, MCITP-DBA, Microsoft Certified Trainer (MCT)
– How did I get here? Here’s the three things that got me here.

I enjoy working a lot with SQL Server. I’ve been working with SQL Server since SQL Server 2000. I’ve worn many different hats – trainer (been teaching/training since 2003!), developer (design, scripts, stored procedures, functions, tuning, troubleshooting, SQLCLR, SQLXML, integration with ERPs, CRMs and PowerShell), DBA (installing, configuring, tuning, maintenance, transaction log shipping, replication, database mirroring, partitioning etc), BI developer (SSRS, SSIS, ETL, SSAS, OLAP, Cubes, MDX) – but one thing remains. I still find working with SQL Server a lot of fun.

Besides SQL Server, I also – in previous positions – have worked extensively with SharePoint (installing, configuring, creating custom pages, branding, web parts, features, workflows) and general web development (HTML/CSS/jQuery/C#/ASP.NET/XML).

I’m a proud member of PASS (Professional Association of SQL Server). I blog (sqlmusings.com), tweet (@sqlbelle), speak (VANPASS, SQLSaturday, etc), train (BCIT, QueryWorks Solutions) and write (Idera, SSWUG, etc).

Contact me
Here is my shameless plug. If you need any SQL Server help, don’t hesitate to ask. Call me, email me, post a comment in my blog. Don’t worry, I don’t bite. Contact details at the QueryWorks Contact Page (or you can send me an email at donabel dot santos at queryworks dot ca.

What is this blog for?
This blog contains some of the things I learn about SQL Server, some of the gotchas that got me, and some of the gotchas I escaped from thanks to other people’s blogs, articles and what nots.

These are my own discoveries as I work with SQL Server. Everyday, I learn a new thing or two about SQL Server. I learn a lot from colleagues, students, and other books and blogs. I am using this blog as a medium to retain a little fraction of this learning, and to share it in case it’s useful to someone else.

Geeky as it sounds, I *really* love working with SQL Server and I *really* love teaching SQL Server. I am excited to learn more about this product, be it development, reporting, administration, SQL on the cloud, SQL clustering – the sky is the limit.

I used to be the resident SQL Ninja at Black Ninja Software. Black Ninja Software is a forward thinking, proactive SharePoint/ASP.NET/SQL Server consulting company in Vancouver, British Columbia.

As a SQL Ninja, I worked on the SQL projects for clients – remote administration, configuration, reporting, optimization, profiling, and a whole lot of querying.  I also did corporate SQL Server training. At Black Ninja, I work with some of the coolest, smartest people around town.

In another previous job, I worked as a DBA for one of the biggest advertising companies in Canada (for their real estate and automotive vertical). I also used to work a lot with MySQL and SharePoint (both WSS and MOSS), so you will find tidbits about MySQL and SharePoint in this blog. I used to actively blog about SharePoint in sharepointmusings and have been involved in administration, customization (branding, web parts, features, BDC, SSRS integration) of SharePoint projects.

SQL Server Connection

Did I mention yet that I *love*  working with SQL Server?

My experience in SQL Server 2000/2005/2008/R2 includes:
– SSRS, SSIS, SSAS
– PowerShell
– code, code, code, including user defined functions (UDFs), Stored Procedures, Triggers, SQLXML, SQLCLR
– general administration
– security and user/permission management
– backup/restore
– general troubleshooting, tuning, profiling
– high availability strategies (log shipping, database mirroring, replication)
– playing with 2008 new shiny things (policy based management, resource governor, Change Tracking, Change Data Capture, SQL Audit, Management Data Warehouse)
– query optimization, indexes
– integration with SharePoint
– training/mentoring/teaching

My previous positions include:

– SQL Server Developer/DBA/Ninja at Black Ninja Software in Vancouver, British Columbia

– SQL Server Developer/DBA (database administrator)
– SharePoint/SQL Server/C# developer/consultant
– MySQL/PHP/Perl developer
– Linux sys admin
– Web developer (HTML/XHTML/CSS/Javascript/XSL)

Previous Talks/Speaking Engagements:

I also like sharing what I learn either in classroom lectures, or speaking engagements within the development community.
Check out my past presentations and materials at http://www.sqlmusings.com/presentations-and-webcasts/

Additional Stuff About Me:

belle’s BCIT Profile 1 2
belle’s SharePointMusings
belle’s LinkedIn

Certifications

Microsoft Certified Trainer

Microsoft Certified Trainer (MCT)

Microsoft Certified Information Technology Professrional (MCITP) - DBA, Developer

Microsoft Certified Information Technology Professrional (MCITP) - DBA, Developer

Microsoft Certified Technology Specialist (MCTS)

Microsoft Certified Technology Specialist (MCTS)

Microsoft Certified Professional (MCP)

Microsoft Certified Professional (MCP)

*Postings in this blog are provided “AS IS” with no warranties
*avatar by faceyourmanga (http://www.faceyourmanga.com)

Getting maximum consecutive years in #SQLServer T-SQL using Common Table Expressions #CTE

August 20th, 2015

This is an expansion (and slight variation) of Joe’s answer in StackOverflow regarding the thread Find the maximum consecutive years for each ID’s in a table (Oracle SQL) using SQL Server. I’ve tested this in SQL Server 2014, but should work from SQL Server 2005 onwards where the ranking functions are supported.

The problem Joe solved is not uncommon – i.e. how to get the consecutive years of something (consecutive year sales, consecutive years in school, consecutive years volunteering etc), and his solution is pretty clever.

Let’s assume you are working on a sales database. You have multiple clients who could be purchasing from your store several times a year, or a couple of times every five years. You may want to know what’s the maximum consecutive years they’ve purchased from you. Why? Perhaps in a marketing campaign, you may want to give your loyal customers (purchased in 5 or more consecutive years) a special discount.

Your data may look like the following screenshot. Notice that in this example, Client 00001, 00002 and 00003 purchased only once. Client 00004 purchased several times, and it looks like there were purchases in consecutive years.

See full article here at sqlbelle.com

VN:F [1.9.22_1171]
Rating: 10.0/10 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
About a belle, 8.0 out of 10 based on 10 ratings
Be Sociable, Share!
< |||| > 1 2 3 4 5
VN:F [1.9.22_1171]
Rating: 8.0/10 (10 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
About a belle, 8.0 out of 10 based on 10 ratings
Be Sociable, Share!
`