I’m a runner as well as a DBA. I’ve got a marathon this weekend, so I started thinking about how SQL and running are similar.
- Small issues in your mechanics will show up later when performance is needed.
- You have your good days and your bad days.
- Sometimes you’ve got to grin and bear it and grind it out.
- Sometimes you’ve got to get up earlier than you want.
- You need goals and objectives to improve.
- Hard work is subjective to what you’re used to.
- You have to keep testing yourself to reach your highest potential.
- Sometimes you want friends to join you, sometimes you need some alone time.
- Someone is always better than you.
- Changing what you’re working on improves overall performance.
I’ve updated the script for Running Events to use the time data type for SQL2008.
Also here’s a little script I used to track my goal of running 200 miles in May. It gives a visual graph of actuals vs goal as well as percentage of month used.
Set nocount on Declare @miles float Declare @Goalmiles int Declare @divisor int --Change these based on your milage/goal Set @miles = (8+10+11+16+12+10+13.5+22+11+11+11) Set @Goalmiles = 200 Set @divisor = 2 Select Replicate('@', @Goalmiles/@divisor) + Char(13) + Char(10) + Replicate('@', @miles/@divisor) + ' -- ' + convert(varchar(10), @miles/@Goalmiles) + '%' + Char(13) + Char(10) + convert(varchar(10), @miles) + ' of ' + convert(varchar(10), @Goalmiles) as 'Progress' --Find the percentage of the month gone Select round(datepart(D, GETDATE())/convert (float, datepart(D, DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)))), 4) as '%ofMonth'