Wednesday, December 17, 2008

Create a content page from a Master page in Microsoft SharePoint Designer 2007

1. On the File menu, point to New, and then click Create from Master Page.
Tip You can also right-click the master page in the Folder List, and then click New from Master Page on the shortcut menu.
2. In the Select a Master Page dialog box, do one of the following:
-> Click Default Master Page to use the master page that is currently set as the site’s default master page.
-> Click Custom Master Page to use the master page that is currently set as the site’s custom master page.
-> Click Specific Master Page to use a master page of your choosing that is not currently set as either the site’s default master or custom master, and then click Browse to locate and select the master page that you want.
Note If you choose a specific master page, the master page must reside in the same site collection as the current site.
3. Click OK.

Friday, September 12, 2008

Open and Free Software for Windows

Not only was all of the software free, every piece of it was open source, which means that the code is peer-reviewed; no spyware here!

What follows is a list of thirty pieces of software that are the cream of the crop of open source software for Windows. Not only is every piece of it free, almost all of them directly replace expensive software packages.

Now, if only there were an open version of The Sims 2, I might go the whole way and switch to Linux…

1. Firefox
http://www.getfirefox.com/
Replaces Internet Explorer
If you haven’t switched to Firefox for your web browsing needs, do it now. It stops annoying popups and it has tons of amazing plugins that can make surfing the web even better. I could evangelize all day about Firefox, but one thing’s for sure: the first thing I do on any new Windows machine is run Internet Explorer just long enough to download Firefox.

2. Thunderbird
http://www.mozilla.org/thunderbird/
Replaces Microsoft Outlook or Eudora
Thunderbird is an email client that has five big things going for it: it’s free, it’s full featured, it’s lightweight and runs quick, it has an unparalleled spam filter, and it protects you from those ridiculous phishing attacks by clearly indicating which emails send you to a bogus website. If you’re not already using a web-based email solution, Thunderbird should be your client.

3. Sunbird
http://www.mozilla.org/projects/calendar/sunbird/
Replaces Microsoft Outlook’s calendaring functions
Might as well get the Mozilla trifecta out of the way by mentioning Sunbird, which is the Mozilla Foundation’s calendaring program. It’s extremely easy to use (I figured out everything I needed in a minute or two) and easy to share your calendar with others. I consider a calendaring tool to be essential if you’re using a laptop, and this is no different.

4. Abiword
http://www.abisource.com/
Replaces Microsoft Word
Want a good word processor but find Microsoft Word too expensive? AbiWord is my favorite replacement for Word. It’s lightweight (meaning it runs quickly) and includes pretty much every feature that I use regularly in a word processor, plus it can save files in formats that you can exchange with Word and WordPerfect users, plus open any of their files, too.

5. OpenOffice
http://www.openoffice.org/
Replaces Microsoft Excel and Microsoft PowerPoint
If you want to replace the rest of the Office suite, your best bet is OpenOffice. It includes very nice replacements for Excel and PowerPoint (and workable replacements for Access and other Office elements). In fact, I actually prefer their Excel and PowerPoint replacements to the real thing.

6. ClamWin
http://www.clamwin.com/
Replaces Norton AntiVirus or McAfee
ClamWin is a slick anti-virus software that’s quite easy to manage and is unobtrusive while keep your system free of viruses. That’s pretty much all I want from a package, so why pay money for McAfee to keep bugging me all the time?

7. Gaim
http://gaim.sourceforge.net/
Replaces AIM, Windows Messenger, etc.
This is a very clean instant messaging program that allows you to be on AOL Instant Messenger, Windows (MSN) Messenger, and Yahoo Messenger simultaneously with one program. There are other free packages that do this, but Gaim is stable and clean and simple.

8. BitTorrent
http://www.bittorrent.com/
Original but essential
From their website, “BitTorrent is a peer-assisted, digital content delivery platform that provides the fastest, most efficient means of distributing, discovering, and consuming large, high-quality files on the Web. Our mission is simple: to deliver the content that entertains and informs the digital world.” In other words, BitTorrent allows you to download large media files and also use your bandwidth to help others download these files. Search for media files you want and download ‘em.

9. GIMPShop
http://www.gimpshop.net/
Replaces Adobe Photoshop
This is a version of the GNU Image Manipulation Program that does a pretty solid job of imitating Adobe Photoshop - a regular user of Photoshop (like me) can adapt to it quite quickly. It’s very richly featured and runs quite well - in fact, I see no reason to ever go back, even if Photoshop were free.

10. Gnucleus
http://www.gnucleus.com/Gnucleus/
Replaces LimeWire, BearShare, etc.
Sure, LimeWire and BearShare are free, but why not just get the same basic software without all of the spyware? Gnucleus is pretty much identical to those software packages - but without all that extra junk that slows down your computer.

11. VLC Media Player
http://www.videolan.org/vlc/
Replaces Windows Media Player, Quicktime, RealPlayer, etc.
If you get tired of having tons of media players on your computer, get this package that runs pretty much every media type you’ll run across without breaking a sweat.

12. Juice
http://juicereceiver.sourceforge.net/
Unique but essential
Juice lets you effortlessly subscribe to podcasts, organize them, and listen to them at your convenience. In conjunction with PodNova, I find it easier to use Juice to organize podcasts than using iTunes itself.

13. Audacity
http://audacity.sourceforge.net/
Unique but essential (for some)
If you’re interested in recording your own podcast (or just want to make your own voice recordings for whatever reason), Audacity and a microphone are pretty much all you need to get the job done. I’m not much for podcasting (let’s just say I don’t have a radio voice), but I use Audacity for other voice recording purposes.

14. RSSOwl
http://www.rssowl.org/
Unique but essential
RSSOwl is one of many open source RSS readers. In other words, it enables you to use one program to keep track of the content of a lot of different blogs; if you read a lot of blogs, it’s the only way to keep tabs on all of them without devoting hours jumping from site to site. If you have a laptop, it’s preferable to using sites like Bloglines, but if you’re on a desktop, a web-based feed manager might be better.

15. Filezilla
http://filezilla.sourceforge.net/
Replaces WinFTP
Many people occasionally have a need to FTP files to other computers; if you ever have the need to transfer files in such a fashion, FileZilla will do the job slickly and quickly.

16. Keynote
http://www.tranglos.com/free/keynote.html
Unique but essential
Keynote is basically designed specifically for the task of taking notes on a laptop. If you ever find yourself in a meeting or a presentation with your laptop open and want to jot down notes and organize them just a bit, Keynote is unquestionably the program for you. It’s not good at quality word processing, but that’s not the point. In my professional work, I find myself using Keynote almost as often as any other utility.

17. MusikCube
http://www.musikcube.com/
Replaces iTunes
If you’re not already committed to downloaded music from the iTunes Music Store, then MusikCube is the best choice available for a music organizer and player. It organizes your mp3s, makes it really easy and really fast to find them, and allows you to make some incredibly clever smart playlists.

18. Handbrake
http://handbrake.m0k.org/
Unique but essential
Handbrake enables you to stick a DVD in your DVD drive and have the contents of that film stored to your hard drive in a form that can be read by pretty much any media player. I often use it to put a few movies on my laptop for travel purposes, so I don’t have to worry about keeping track of DVDs while on the road.

19. X-Chat 2
http://www.silverex.org/
Replaces mIRC
X-Chat is a free IRC client. For those unfamiliar with IRC, it’s a place for technical people (and, as my wife loves to point out, nerds) to meet and discuss topics in an open environment. I often find it very useful when piecing through difficult technical issues.

20. KeePass
http://keepass.sourceforge.net/
Unique but essential
KeePass is a program that securely stores and manages the abundance of passwords we all use on a daily basis. I have literally hundreds of usernames and passwords spread out all over the place; KeePass keeps them all for me and keeps them safe.

21. TrueCrypt
http://www.truecrypt.org/
Unique but essential
TrueCrypt enables you to convert a memory stick into a strongly encrypted data storage device, meaning that you can store personal data on it without worrying about losing it and having personal information get out and about. I use it to keep some of my most personal data off of my laptop and strongly secured, just in case.

22. PDFCreator
http://sourceforge.net/projects/pdfcreator/
Replaces Adobe Acrobat
PDFCreator creates a virtual printer on your computer that, if you print a document to it from any program, creates a PDF of that document that can be read on any computer with Acrobat Reader on it. After installing PDFCreator, all you have to do is print like normal and out comes a PDF!

23. Freemind
http://freemind.sourceforge.net/
Unique but Essential
Freemind is a “mind mapping” software program. In essence, it enables you to brainstorm and link together ideas quickly, creating “maps” of concepts similar to what you might do on a whiteboard. I find it incredibly useful when putting together ideas for new posts or planning small projects or assembling the backbone of a writing project.

24. NASA Worldwind
http://worldwind.arc.nasa.gov/
Replaces Google Earth
WorldWind is very similar to Google Earth in that it allows you to browse the globe. While it isn’t strong for creating maps (but why not just use Google Maps for that?), it is utterly incredible for viewing three-dimensional landscapes of any place on earth.

25. Notepad2
http://www.flos-freeware.ch/notepad2.html
Replaces Notepad
Notepad2 is a replacement for the traditional Windows Notepad that just adds a few sweet little features: multiple documents; line, word, and character counts; and some highlighting of tags. In fact, I’m using Notepad2 as I draft this post (after using Freemind to organize it).

26. HealthMonitor
http://healthmonitor.zucchetti.com/
Unique but useful
HealthMonitor enables you to keep an eye on the health of your computer. It identifies slowdowns and other system issues quickly and lets you know (for example, it gives a popup if your system memory gets to a certain percentage of fullness, or if your hard drive has only 10 GB free). This can keep you out of trouble and also give you clues to problems your machine might be having.

27. Workrave
http://www.workrave.org/
Unique but useful
Sometimes late into a writing session, my wrists get sore from too much repetitive movement. Workrave basically jumps in before this happens and locks down the computer for a while, preventing me from working too much and causing repetitive stress injury. Since I’ve started using it, it hasn’t significantly hurt my productivity at all and my wrists are thanking me!

28. GanttPV
http://www.pureviolet.net/ganttpv/
Replaces Microsoft Project
If you do any project management (or have a need to dip your toes in the water), GanttPV does a brilliant job of managing the task quickly, easily, and freely. If you need to move to MS Project later, you can export from GanttPV to Project, but once you start digging into GanttPV, you’ll likely have no reason to use Project.

29. GnuCash
http://www.gnucash.org/
Replaces Microsoft Money or Quicken
GnuCash is a slimmed-down version of the bloated Microsoft Money and Quicken packages, but it contains all of the features I want for managing my money. The interfaces are incredibly simple - it functions much like a checkbook ledger on your computer - but there’s a lot of meat hidden throughout the software.

30. True Combat: Elite
http://www.truecombatelite.net/
Replaces Quake IV, Halo, etc.
After all this downloading, you’re going to need to blow off a little steam, and I’ve yet to find a more enjoyable free game than this one. It’s basically a third person combat game, but the graphics are spectacular and the game is quite engrossing.

If you’ve downloaded and installed all of these, you’ve got access to all the productivity software you’ll likely need, clean and open and best of all free.

Friday, May 30, 2008

.NET Test Driven Development

csUnit - open source testing framework
NUnit - open source testing framework
mbUnit - open source testing framework - lots of interesting features!
ZaneBug - unit testing which includes interesting enhancements for performance metrics, etc.

.TEST - commercial automated unit testing software
HarnessIt - commercial testing framework
Unite.NET - commercial unit and integration test software
X-Unity - commercial testing framework

NUnitAddin - Visual Studio add-in, currently has command-line interface (I hear Jamie Cansdale is working on a GUI with red/green bars)
NUnitASP - test web sites by interacting programmatically with the controls on the web page. Now supports authentication as well as several other new features! Also see my NUnitAsp Tips and Best Practices.
NUnitForms - allows you to test Windows Forms in a manner similar to NUnitAsp (you get to interact with the form elements programmatically). It even includes a recorder application!
RUnit - runs NUnit test harnesses in ASP.NET.
TestRunner for NUnit - an NUnit add-in for Visual Studio .NET. See blog post.
VSNUnit - an NUnit add-in for Visual Studio .NET. See blog post.

Mock Objects

DotNetMock
EasyMock.NET
MockObjects
NMock
POCMock

Web sites / columns

Applying Patterns to Software Testing - Brian Marick
Bret Pettichord's Publications on testing
Brian Marick's writings on software testing
Cem Kaner's articles on testing
James Bach's articles
ObjectMentor's Test Driven Development articles
TestDriven.com web site, general purpose portal that includes various languages, testing tools, and articles.
testingReflections - a hub for Software Testing knowledge and information

Test Driven Development Column Dave Astels
Test Driven Development Yahoo! group
Pages on the c2 wiki:

TestDrivenDevelopment
TestingCategory

UnitTest - check out all the links at bottom

Blogs

Antony Marcano has a software testing focused blog.
Benjamin Mitchell has an excellent XP and Agile category including lots of TDD
Brian Marick's blog is all about testing
James Newkirk, lead developer on NUnit and now Microsoft employee, has an excellent TDD blog.
Jamie Cansdale, creator of the TestDriven.NET addin for Visual Studio, has a blog.
Jay Kimble has a TDD category
Jens Winter has a TDD category
Jonathan Cogley has a TDD category
Jonathan de Halleux - the creator of mbUnit
Roy Osherove has a Test Driven category
Siva Rama Krishna has a blog devoted to software testing
Steve Eichert has a TDD category
See my Test Driven Development category

Unit Testing articles

Adventures in C#: Using NUnit - Ron Jeffries
Advanced Unit Testing: Parts 1, 2, 3, 4, 5 - Marc Clifton
An Initial Investigation of Test Driven Development in Industry - Laurie Williams and Boby George
Best Practices: Test Driven Development
Charles' Six Rules of Unit Testing - Charles Miller
Contractual Test Driven Development: Combining Test Driven Development and Design By Contract - Dave Chaplin
csUnit Tutorials - a group of related tutorials on csUnit, including one on how to port from NUnit
Developing Automated Tests using NUnit2 with VB.NET - Dave Chaplin
Effective Unit Testing - Tim Burns
Endo-Testing: Unit Testing with Mock Objects - Tim Mackinnon, Steve Freeman, Philip Craig
Debugging .NET with NUnit - Paul Kimmel
Fun with Unit Tests-Testing Abstract Classes - Roy Osherove
Interview: XP Pioneer Stumps for Test-Driven Development - Jon Udell on InfoWorld
Introduction to Test-driven Development with NUnit and the NUnit Add-in - Roy Osherove
An Introduction to Test-Driven Development (TDD) – code examples are in C# and Delphi using csUnit.

An Introduction to Test-Driven Development (TDD) using Visual Basic.net – code examples in VB.NET using csUnit.
NUnitAsp article - Melwyn D'Souza and Sarvesh Damle
NUnit V.2 For People Who Can't Cook - Markus Kalina, not the latest version of NUnit
Perform Code Coverage Analysis with .NET to Ensure Thorough Application Testing - James McCaffrey
Putting Test Driven Development into Practice - Jimmy Nilsson
TDD with NUnit and C# - PowerPoint presentation by Jonathan Cogley
Test Driven Analysis and Design - Jason Gorman
Test Before You Leap Into Development - Jon Udell on InfoWorld
Test-Driven C# : Improve the Design and Flexibility of Your Project with Extreme Programming Techniques - Will Stott and James W. Newkirk
Test Driven Development - ObjectMentor's write-up on TDD
Test Driven Development - Scott Ambler, chap 11 of his Agile Database Techniques book
Test Driven Development and Acceptance Testing - James Grenning
Test-Driven Development, A Conversation with Martin Fowler, Part V - Bill Venners on Artima.com
Test Driven Development and Web Services - Peter Provost, uses NUnit
Test Driven Development in .NET - Peter Provost, uses NUnit
Test Driven Development in Enterprise Integration Projects - Gregor Hohpe and Wendy Istvanick
Test Driven Development using NUnit - Jason Gorman
Test First Guidelines - Sean Shubin
Testing ASP.NET Applications with NUnitASP and NUnit - Justin Gehtland
Testing for Programmers - Brian Marick, very very good!
Unit Testing and Test-First Development - on MSDN
Unit Testing Database Code - Richard Dallaway
Unit Testing in .NET - Charlie Poole, 79 PowerPoint slides
Unit Testing in .NET - Justin Gehtland
When Do You Stop Unit Testing? - Gordon Weakliem
Work Guidelines: Test Driven Development
Working backwards - James Newkirk, Robert C. Martin
Write Unit Tests - Nick Smith in Visual Studio Magazine
Writing Automated Browser Tests using NUnit and IE - Dave Chaplin
Refactoring Books

Refactoring: Improving the Design of Existing Code by Martin Fowler – excellent
Refactoring Workbook by William Wake – very good
Refactoring to Patterns by Joshua Kerievesky – forthcoming book, see the web site

Software

C# Refactoring Tool – $110 for 1-9 licenses, $99 for 10 or more
C# Refactory – $99 first license, $50 each additional, 30 for $549
dotEasy – currently free
FlyWheel – $449
Resharper – use a username and password of eapuser, pricing not set
Visual Studio – will include refactoring in the Whidbey release, due in 2005

Web Sites

Agile .NET Development – Refactoring - by Jason Gorman, C# tutorial on refactoring
Fowler Refactoring Example - by Dave Veeneman, a C# translation of the 'Starting Point' example in Chapter 1 of Fowler's Refactoring book
Refactoring Home page – a portal on refactoring maintained by Martin Fowler
Refactoring Yahoo! group
Refactoring with Martin Fowler – Artima interview by Bill Venners
The Process of Database Refactoring – by Scott Ambler
Refactoring Refactoring – article by Robert X. Cringely that questions refactoring

Wednesday, April 23, 2008

25 hints that shows your city has been metropolitinized

1. Plots in adjacent (50Km Radius) villages and towns are hot selling cakes while it is very rare to find a small undisputed vacant plot within city limits.
2. Govt. approves construction of more special economic zones, multi storey parking and bridges.
3. Bus stand which was earlier inside the city are now shifted to outskirts.
4. Business in you town advertise on satellite channels.
5. A car for each adult in the family is no more a luxury.
6. Playgrounds are extinct and replaced by PlayStations.
7. Most mobile users have atleast 2 active connections.
8. Orkut and MySpace are fashion talks among the teenagers.
9. Terms like “Ill scrap you” and “Ping me later” are conversed between 2 friends when they bump onto each other.
10. 2 wheelers are always driven with earphones on and its playing one of the numerous FM stations.
11. Traditional theatres are converted to Multiplexes and Marriage mahals are converted to shopping malls.
12. A cup of coffee costs Rs. 50 or more.
13. It’s no more acceptable to dial up and connect to internet.
14. Even the very smallest business in town has billboards in bridges sizing upto atleast triple the size or their showroom.
15. Bicycles are only sold in antique shops and Milkman and paper boy delivers on a motor bike and converse on a mobile phone.
16. It is very very very difficult to differentiate between a Guy and a Girl based on the hair-do.
17. Tele marketing calls are annoying and your kids work in BPO as tele-marketers.
18. Every other guy on the road wears an Identity card just the way your pet dog does.
19. Every hotel in the city has converted their basement into a dancing floor cum bar and call it a weird sounding name.
20. You have 15 numbers to reach your family of 3.
21. Dog shows and fashion shows are more crowded than temples.
22. Bus, Railway and Air tickets are booked 2 months in advance and Stations and ports in the city are crowded when the week ends and the the city is deserted on all festive occasions.
23. You find walkers and joggers traffic in almost all the roads at early hours of the day.
24. Your boss understands and emphatizes when you give “Traffic congestion” as an excuse to coming late to office.
25. Real estate / Rentals / Leasing are the most happening business only next to starting a Tea shop near a software company.

The unique spirit of an unique Festival… சித்திரை திருவிழா

Anyone who knows Madurai would be able to tell you that Madurai is famous for Maligai(Jasmine), Temples, Idly and dharuma adi (loosely translated as free hits…). The temples and its culture in Madurai is so unqiue that no place in the world one would be able to locate similar spirit and dedication.images

Madurai Temples have festivals and functions which have been in practice for centuries and have been practiced with the high level of enthusiasm, fun and frolic. The world famous Alanganallur jallikattu, Thiruparankundram Vaigaasi Visagam, Mariamman Temple tank float festival are just a tip of the iceberg in the list of world famous Madurai Festivals. Toping this list is the Annual Chithira Pournami grand festival.images

This is a festival of 2 major temples and a multitude of smaller temples. This spans for about 15 days. The first 10 days its Meenakshi Amman’s crowning and celestial marriage. This is followed by the 5 days festival when Alagar from Alagar Kovil visits Madurai. The story is that Alagar being the brother of Meenakshi comes to Madurai for her marriage. But is delayed by the love and affection of the people on his way. When he finally arrives, the Marriage is over. So he is disappointed and just takes a dip in Vaigai River and returns back to Alagar Kovil. But almost whole of Madurai population know that this story was made up by Thirumalai Nayakar, who once upon a time ruled over Madurai. The 2 temple functions are completely independant and to pull more crowd from nearby villages, Nayakar came up with the story and thus The Annual Chithirai Thiruvizha came into existence.images

When it is more than obvious that this is a fabricated story, still why do people celebrate the festival? The festival is celebrated with so much zeal and hype that it appears that 15 days of Diwali or Pongal is being celebrated in Madurai alone. People from far and near make it a point to come to Madurai and be a part of this mega event even though they make their living elsewhere. Madurai citizens celebrate the Celestial wedding as though its a wedding in their own house. They welcome Alagar into Madurai like they welcome a close relative into their house. No caste/creed bar, everyone is in celebration mode. But why all this for a fabricated story?images

The question remains unanswered. No one can answer this. It is like trying to define space or draw boundary to love. I wouldn’t call it faith or just prayers. Faith. prayers or offerings can be practised at home or in the temple. But the core reason behind celebrating the function for 15 days is still unexplained.images

I have been to many places, Celebrated many festivals, heard and read about people around the world and their culture. But to my knowledge nothing comes to close to Madurai and Chithirai Thiruvizha. If you are still not convinced, try and tell me one place / festival which satisfies all the following characteristics.

1. 10 days of celestial marriage celebrated. 5 days of celestial visit celebrated.
2. 24 hours of all 15 days, some activity or other with respect to this festival is on the run.
3. God / Deity’s idol visits almost the entire city.
4. The festival being celebrated in all nooks and corners of the city.
5. Devotees helping other devotees to participate in the festival by offering water, buttermilk, juices and food to beat the heat.
6. (Touchwood) In all the years of celebration not a single major untoward incident has been reported.
7. Devotees thronging the streets like mad persons chanting the name of God and being drawn towards him like a magnet.
8. Money spent throughout the festival is not out of a single pocket or account. But its the money from every single person associated with the city.
9. 6 years old to 60, everyone is on celebration mode.
10. “Rich or poor, God is one” being practiced and promoted.
11. Ancient laws and methodologies followed without a single slippage.
12. No body complains that this festival is disrupting their normal life. Nobody…

Well, if you find a valid answer for my question, I will accept my defeat. But for time being, the challenge is on!images

Wednesday, February 6, 2008

SQL Server performance tips

Does your SQL statement have a WHERE clause?
I know this sounds obvious, but don't retrieve more data than you need. However, less obvious is that even if your SELECT statement retrieves the same quantity of data without a WHERE clause, it may run faster with one.

Is SELECT DISTINCT being used properly?
Again, pretty obvious, but using SELECT DISTINCT where no duplicate records are being returned is an unnecessary performance hit. If you are getting duplicate records, first double check your table joins as this is often the cause and only use the DISTINCT clause if you really need it.

Are you using UNION instead of UNION ALL?
A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records returned are unique from your union, use UNION ALL instead, it is much quicker.

Are your stored procedures prefixed with 'sp_'?
Any stored procedures prefixed with 'sp_' are first searched for in the Master database rather than the one it is created in. This will cause a delay in the stored procedure being executed.

Are all stored procedures referred to as dbo.sprocname?
When calling a stored procedure you should include the owner name in the call, i.e. use EXEC dbo.spMyStoredProc instead of EXEC spMyStoredProc.

Prefixing the stored procedure with the owner when executing it will stop SQL Server from placing a COMPILE lock on the procedure while it determines if all objects referenced in the code have the same owners as the objects in the current cached procedure plan.

Are you using temporary tables when you don't need to?
Although there is sometimes a benefit of using temporary tables, generally they are best eliminated from your stored procedure. Don't assume that retrieving data multiple times is always less efficient than getting the data once and storing it in temporary table as often it isn't. Consider using a sub-query or derived table instead of a temporary table (see examples below). If you are using a temporary table in lots of JOINS in you stored procedure and it contains loads of data, it might be beneficial to add an index to your temporary table as this may also improve performance.

An example of a derived table instead of a temporary table
SELECT COLUMN1, COLUMN2, COUNTOFCOL3
FROM A_TABLE A
INNER JOIN (SELECT COUNT(COLUMN3) AS COUNTOFCOL3, COLUMN2
FROM B_TABLE B
INNER JOIN C_TABLE C ON B.ID = C.ID) ON A.ID = B.ID

Are you using Cursors when you don't need to?
Cursors of any kind slow down SQL Server's performance. While in some cases they are unavoidable, often there are ways to remove them from your code.

Consider using any of these options instead of using a cursor as they are all faster:
•Derived tables
•Sub-queries
•CASE statements
•Multiple queries
•Temporary tables

Are your Transactions being kept as short as possible?
If you are use SQL transactions, try to keep them as short as possible. This will help db performance by reducing the number of locks. Remove anything that doesn't specifically need to be within the transaction like setting variables, select statements etc.

Is SET NO COUNT ON being used?
By default, every time a stored procedure is executed, a message is sent from the server to the client indicating the number of rows that were affected by the stored procedure. You can reduce network traffic between the server and the client if you don't need this feature by adding SET NO COUNT ON at the beginning of your stored procedure.

Are you using IN or NOT IN when you should be using EXISTS or NOT EXISTS?
If you are using IN or NOT IN in a WHERE clause that contains a sub-query you should re-write it to use either EXISTS, NOT EXISTS or perform a LEFT OUTER JOIN. This is because particularly the NOT IN statement offers really poor performance. The example below probably better explains what I mean:

e.g. This SQL statement:

SELECT A_TABLE.COLUMN1
FROM A_TABLE
WHERE A_TABLE.COLUMN2 NOT IN (SELECT A_TABLE2.COLUMN2
FROM A_TABLE2)

Could be re-written like this:
SELECT A_TABLE.COLUMN1
FROM A_TABLE
WHERE NOT EXISTS (SELECT A_TABLE2.COLUMN2
FROM A_TABLE2
WHERE A_TABLE.COLUMN2 = A_TABLE2.COLUMN2)

Do you have a function that acts directly on a column used in a WHERE clause?
If you apply a function to a column used in the WHERE clause of your SQL statement, it is unlikely that the SQL statement will be able to make use of any indexes applied to that column.

e.g.
SELECT A_TABLE.LASTNAME
FROM A_TABLE
WHERE SUBSTRING (FIRSTNAME,1,1) = 'm'

Could be re-written:
SELECT A_TABLE.LASTNAME
FROM A_TABLE
WHERE FIRSTNAME LIKE = 'm%'

Where you have a choice of using the IN or BETWEEN clauses
Use the BETWEEN clause as it is much more efficient

e.g. This SQL statement:

SELECT A_TABLE.NAME
FROM A_TABLE
WHERE A_TABLE.NUMBER IN (100, 101, 102, 103)

Should be re-written like this:
SELECT A_TABLE.NAME
FROM A_TABLE
WHERE A_TABLE.NUMBER BETWEEN 100 AND 103



SQL Server performance tuning can consume a considerable amount of time and effort. The following list is a quick guideline that you should keep in mind when designing and developing SQL Server database applications:

User Defined Functions (UDF)
Refrain from using user defined functions (UDF) in a select statement that may potentially return many records. UDFs are executed as many times as there are rows in a returned result. A query that returns 100,000 rows calls the UDF 100,000 times.

SQL Server table indexes
Create SQL statements that utilize defined table indexes. Using indexes minimizes the amount of table scan which in most cases will be much slower than an index scan.

Multiple disks
The single best performance increase on a SQL Server computer comes from spreading I/O among multiple drives. Adding memory is a close second. Having many smaller drives is better than having one large drive for SQL Server machines. Even though the seek time is faster in larger drives, you will still get a tremendous performance improvement by spreading files, tables, and logs among more than one drive.

Disk controllers
Different disk controllers and drivers use different amounts of CPU time to perform disk I/O. Efficient controllers and drivers use less time, leaving more processing time available for user applications and increasing overall throughput.

SQL Server foreign keys
Ensure that all your tables are linked with foreign keys. foreign keys enhance the performance of queries with joins. Database tables inside each application are naturally related. Islands of tables are rarely needed if your application's business logic is well defined.

SQL Server primary keys
Ensure that every table has a primary key. if you can't find a natural set of columns to serve as a primary key, create a new column and make it a primary key on the table.

Processor (CPU)
When you examine processor usage, consider the type of work the instance of SQL Server is performing. If SQL Server is performing a lot of calculations, such as queries involving aggregates or memory-bound queries that require no disk I/O, 100 percent of the processor's time can be used. If this causes the performance of other applications to suffer, try changing the workload of the queries with aggregates.

Are you doing excessive string concatenation in your stored procedure?
Where possible, avoid doing loads of string concatenation as it is not a fast process in SQL Server.

Have you checked the order of WHERE clauses when using AND?
If you have a WHERE clause that includes expressions connected by two or more AND operators, SQL Server will evaluate them from left to right in the order they are written (assuming that no parenthesis have been used to change the order of execution). You may want to consider one of the following when using AND:
•Locate the least likely true AND expression first. This way, if the AND expression is false, the clause will end immediately, saving time.
•If both parts of an AND expression are equally likely being false, put the least complex AND expression first. This way, if it is false, less work will have to be done to evaluate the expression.

Have you checked that you are using the most efficient operators?
Often you don't have much of a choice of which operator you use in your SQL statement. However, sometimes there is an alternative way to re-write your SQL statement to use a more efficient operator. Below is a list of operators in their order of performance (with the most efficient first).
•=
•>, >=, <, <=
•LIKE
•<>