Search This Blog

Saturday, February 15, 2014

How to Organize Work

I figured this quadrant helps a lot to take the work load off and help with reducing the stress.


See if this helps you!



 Work



How to Organize Work

Tuesday, December 17, 2013

Brain Teaser Series - The Chocolate Shop!!

Everyone loves candies and chocolate. It’s even more fun when you can some free ones.


Here is puzzle for you.


A candy shop sells a chocolate for $1 each and for every 3 empty wrappers gives one chocolate. How many chocolates can you get for $15?


Enjoy!!



Brain Teaser Series - The Chocolate Shop!!

Friday, December 6, 2013

Exuberant India - Visit Mussoorie (Fun Retreat in a Hillstation Close to Delhi)

Mussoorie, Queen of the Hills, located some 290 km north of New Delhi, is among the most popular hill stations of the country. At 6500 feet elevation, it has some of the most spectacular views of Himalayas. Some of the landmarks of this popular hillstation are the old graceful houses – Captain Young’s Mullingar Mansion, the oldest existing building in Mussoorie, Houses of Irish pioneers – Tipperary, Killarney, Shemrock cottage and the Tara hall, the houses of Scot pioneers – Scottsburn, Wolfsburn and of course the houses of the English rulers – Connaught Castle, Grey castle, Hampton court and Castle hill. There evidently were a lot of fans of the legendary writer Sir Walter Scott as we find old estates of the name of Kenilworth, Rockeby, Waverly and also Abootsford – the name of Sir Scott’s own house in England.


Mussoorie has lot to offer and fun retreat for a quick getaway from Delhi.





How to get there:


travel-plane


Air: The nearest airport is Jolly Grant at Dehradun (61 km). However, Delhi is the most convenient airport.


travel-rail


Rail: The nearest railhead is Dehradun 35 km, connected by rail with major cities and towns of India. Taxis and buses are available outside the railway station for transit to Mussoorie, there is a Mussoorie bus stand near the station.


travel-icon


Road: < 300 KM from Delhi. You can drive, take a bus or private cab to get there.


Where to Stay:


Here is a list of some of the good hotels in the area


Jaypee Residency Manor*****dlx,

Barlowganj,

Tel: 0135 2631800,

Fax: 2631022,

E-mail: reservations.jrm@jaypeehotels.com


Savoy Hotel (Heritage),

The Mall,

Tel: 0135 2632010/120,

Fax: 2632001,

E-mail: savoyhotelmussoorie@yahoo.com

(Rs. 1500-5000/-)


Country Inn Mussoorie***,

Nalapani House,

Hayacoolie Estate, Kincraig,

Telefax: 2631190/4,

E-mail: info@countryinn.co.in


Hotel Green Castle***,

The Mall,

Tel: 0135 2630987,

Telefax: 2632657,

E-mail: greencastle@vsnl.com


Hotel Solitaire Plaza***,

Kincraig Road,

Tel: 0135 2632164/5,

Fax: 2632147


What to do:


Sightseeing:



Cloud’s End

The resort is surrounded by thick deodar forests. The bungalow built in 1838 by a British major and one of the first four buildings of Mussoorie, has now been converted into a hotel.




Camel’s Back Road

A lovely promenade along the wooded slopes.


Children’s Lodge 

A vantage point of Mussoorie, with extensive views of the northern hill ranges.




Gun Hill 

The second highest point in the town, it offers a panoramic view of the surroundings and the snow covered mountains in the north.


You can find more information at the state site: http://uttarakhandtourism.gov.in/sections/mount_places/ZjY0ZjZhhnE1NHNkZg==/ZjY0ZjZoc2RmYTU=




Exuberant India - Visit Mussoorie (Fun Retreat in a Hillstation Close to Delhi)

Monday, December 2, 2013

Rebuild all index in a database

Several times my colleagues asked me about rebuilding all indices in a database. While there are several solution available, I like to use the one below. Please note that sp_MSforeachtable is undocumented but internal so we can expect a much better performance than our own cursor.


None the less, this has helped me alot, I hope it helps you too!!


 


USE <DBName>

GO

EXEC sp_MSforeachtable @command1=”print ‘?’ DBCC DBREINDEX (‘?’, ‘ ‘, 80)”

GO

EXEC sp_updatestats

GO



Rebuild all index in a database

Friday, November 29, 2013

Finding the Nth highest value in a table

I recently was asked by a colleague about finding the  Nth highest value in a table. For example if there is an employee table then finding the 10th highest salary or something similar.


I thought about it and created a query below which obviously is not showing anyone’s salary :) but shows how we can implement it.


Enjoy! and please comment.


declare @nth smallint


set @nth = 4


if (@nth <= 0)

begin

– default to 1 if inappropriate value is provided

set @nth = 1

end


set nocount on;


declare @t table (Id int identity(1, 1), Value decimal(18, 3))

insert into @t (Value) values (1234.56)

insert into @t (Value) values (5678.90)

insert into @t (Value) values (2345.67)

insert into @t (Value) values (3456.78)

insert into @t (Value) values (6789.10)

insert into @t (Value) values (7890.12)

insert into @t (Value) values (8912.34)

insert into @t (Value) values (4567.89)


select [Value] = max([t1].[Value])

from @t [t1]

left join (select top (@nth – 1) [Value]

from @t

order by value desc) [t2] on [t2].[Value] = [t1].[Value]

where [t2].[Value] is null


select [OrderId] = ROW_NUMBER() over (order by value desc)

, [Value] = value

from @t


set nocount off



Finding the Nth highest value in a table

Friday, November 8, 2013

Experience with MS SQL Server

After years of experience with SQL server, I have gathered some of the practices that are good for writing SQL queries, procedures and functions.

Here is my work as presentation, enjoy!!