by Rohit
19. January 2013 13:38
Get week start dates of any month
DECLARE @startDate DATETIME
SET @StartDate = '20130101'
;WITH DayCounter(n) AS
( SELECT 0 UNION ALL SELECT n+1 FROM DayCounter WHERE n<30)
SELECT DISTINCT DateAdd(dd,7-(DATEPART(DW,@StartDate+n)-1),@StartDate+n) FROM DayCounter
WHERE MONTH(DateAdd(dd,7-(DATEPART(DW,@StartDate+n)-1),@StartDate+n)) = MONTH(@StartDate)
Get week end dates of any month
DECLARE @StartDate DATETIME
SET @StartDate = '20130101'
;WITH DayCounter(n) AS
( SELECT 0 UNION ALL SELECT n+1 FROM DayCounter WHERE n<30)
SELECT DISTINCT DateAdd(dd,7-(DATEPART(DW,@StartDate+n)),@StartDate+n) FROM DayCounter
WHERE MONTH(DateAdd(dd,7-(DATEPART(DW,@StartDate+n)-1),@StartDate+n)) = MONTH(@StartDate)
by Rohit
15. July 2012 12:43
SQL Server 2012 brings some of the most desired enhancements in the Management Studio to simplify manageability.
(1) The new SQL Server Management Studio is built on Visual Studio 2012. As it opens, you soon recognize the familiar dark blue theme of Visual Studio 2010.


(2) You can drag and move out Query Window from the main work area:

It also has dual monitor support. You can move out a Query Window to another monitor or outside the main IDE.
(3) You can even drag out the ToolBox from the main IDE and place it elsewhere on the desktop or on another monitor.

(4) Being based on Visual Studio, SSMS brings the same Clipboard Buffer feature of Visual Studio 2010. You can cycle through buffer text by holding down the SHIFT key and pressing CTRL+V.
(5) Another interesting feature is Insert Snippet which you can find on menu via Edit -> IntelliSense. It allows you to inject variety of code snippets onto your Query Window:



Above I selected Create Procedure Basic Template to inject stored procedure code. It even provides you with two parameters to start with. You can always remove or add parameters according to your need.
Similarly, you can inject many other type of code snippets like: Function, Index, Table, View etc. There are even more enhancements which are outside the scope of this post.
Technorati : SQL Server, SQL Server 2012, SSMS
Del.icio.us : SQL Server, SQL Server 2012, SSMS
by Rohit
11. July 2012 12:54
If you are coming from Crystal Reports background then you must be aware of a property called Suppress if 0 in Crystal Reports. By default, this property is disabled resulting in zero values being displayed on your report. When checked, all the zero values are suppressed by replacing 0 with a blank space.
SQL Server Reporting Services (SSRS) is quite young when compared to Crystal Reports. It is not as powerful as Crystal Reports but it definitely bundles simplicity and seamless integration with SQL Server data and Visual Studio.
Here I show you how to implement Suppress if 0 functionality in SSRS. In my example I have used SQL Server 2008 Reporting Services. Before starting let's see how the report looks when opened in browser before suppressing zero values:

To suppress zero values, go to Business Intelligence Development Studio and open the report design. My report design looks like this: More...
by Rohit
28. April 2012 22:49
This week I have SQL Server tools for you.
SQL Scripter: Powerful tool for Microsoft SQL Server 7.0/2000/2005/2008 database administrators and developers to generate data scripts in a readable and executable T-SQL format.
NetWrix SQL Server Change Reporter: Monitor and review administrative changes on SQL servers and at database levels. Detect early all unauthorized and unwanted changes that can lead to server and database downtime. The Freeware Edition has few limitations.
SQL Sentry Plan Explorer: A FREE tool that builds upon the graphical plan view in SQL Server Management Studio (SSMS) to make query plan analysis more efficient. It is a lightweight standalone app that contains many of the plan analysis features introduced in SQL Sentry v6. It does not require a collector service or database.
FlySpeed SQL Query: Free SQL query tool for any database. It facilitates the process of building SQL by letting you quickly drag and drop tables to create queries, from simple to complex, and combine visual query building with direct SQL text editing.
by Rohit
7. April 2012 21:52
IgniteFree: Database Response Time Monitoring Tool. Shows performance bottlenecks inside your Oracle, SQL Server, DB2 or Sybase instance.

fwptt: Web load testing framework. It can record normal and AJAX requests.Allows user to record browsing actions using proxy server.

Idera Free Tools: SQL Server tools for performance monitoring, managing SQL agent jobs, copying or moving logins and permissions settings across SQL servers. Also include SharePoint tools and PowerShell scripts.
Raakt: Web accessibility analysis tool that makes it easy to integrate basic accessibility evaluation early in the development process.