# Category Archives: Reporting/BI - Page 2

## T-SQL Create a View for Report Date Ranges by Month

The below example gives prior and current month first and last day values.The code below dynamically formats the date to give you date range values for reporting:

[LFM-FirstDay] – First Day of thePrior Month or Last Full Month First Day,
[LFM-LastDay] – 11:59 PM of the last day of the prior month,
[CM-FirstDay] – Current Month First Day and
[CM-LastDay] – 11:59 PM of the last day of the Current month.

```USE [dbofchoice] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [DBO].[ReportDates] AS /* LFM = LAST FULL MONTH CM = CURRENT MONTH */ SELECT DATEADD(month, -1 ,DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)) as [LFM-FirstDay] ,DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate()),0)) as [LFM-LastDay] ,DATEADD(mm, DATEDIFF(m,0,getdate()),0) as [CM-FirstDay] ,DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())+1,0)) as [CM-LastDay] GO```

## C# – Calculating Distance between Zipcodes

Calculating the distance between ZIP codes has become a common feature in search engines. For instance, if you’re searching for restaurants, a Web site will often allow you to enter a ZIP code and display all of the restaurants within X miles of that ZIP code. Here is one way application developers to implement a ZIP code distance calculator using the .NET Framework and C#.

This article uses a derivation of the Haversine formula to calculate the distance between ZIP codes. The Haversine formula is used to determine the distance between two points on a sphere – in this case the earth. While this isn’t 100 percent accurate due to the earth not being a perfect sphere, it is probably as close as you’re going to get without getting out the tape measure!

Author: Zach Smith
Find TechRepublic Article Here.

## SQl Server 2005 Reporting Services – Charts

Found this link that give a deep-dive into fomat and functionality of charts in SSRS 2005.  Adds a lot to making charts meaniningful and jumps to details.

TechNet Article:
More

## SSRS Links on sql-server-performance.com

Found this link on http://sql-server-performance.com  to various Reporting Services Links : HERE

Good FAQ on http://www.ssw.com.au  on issues and set-up of SSRS – HERE

## SQL Server Management Studio Standard Reports

SQL Server Management Studio 2005 (SP2) updates has a wide range of reports that give the users vital information about server health and database objects.  You can even add your own custom reports to create you own application database dashboards.  The reports are created just like SQL Server Reporting Services RDL’s.