Quantcast
Viewing latest article 7
Browse Latest Browse All 8

10 Things Running and SQL Have In Common

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.

  1. Small issues in your mechanics will show up later when performance is needed.
  2. You have your good days and your bad days.
  3. Sometimes you’ve got to grin and bear it and grind it out.
  4. Sometimes you’ve got to get up earlier than you want.
  5. You need goals and objectives to improve.
  6. Hard work is subjective to what you’re used to.
  7. You have to keep testing yourself to reach your highest potential.
  8. Sometimes you want friends to join you, sometimes you need some alone time.
  9. Someone is always better than you.
  10. 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'

Image may be NSFW.
Clik here to view.
POTD_24_Running 004


Viewing latest article 7
Browse Latest Browse All 8

Trending Articles