Archive from January, 2007
22 Jan
2007
Posted in: Technology
By    No Comments

A Note About Indexing

For queries to run efficiently it is important that appropriate indexes be in place. A simple guideline is that all fields referenced in a comparison in a WHERE clause or in the ON clause of a JOIN statement should be indexed. Bear in mind that all primary key fields are automatically indexed, but that foreign keys must have an index added manually.

Well, there you have it. Now that you have witnessed some of the awesome power of SQL, with its greater flexibility and increased capability, it is easy to see why it is the query language of choice for high-end database servers.

19 Jan
2007
Posted in: Quick Tips
By    No Comments

Useful SQL Functions related to date

Here are few SQL Functions which would be useful when we do some tasks dealing with dates

Dateadd: Returns a new datetime value based on adding an interval to the specified date.

Syntax: DATEADD ( datepart, number, date )

Datediff: Returns the number of date and time boundaries crossed between two specified dates.

Syntax: DATEDIFF ( datepart, startdate, enddate )

Datename: Returns a character string representing the specified datepart of the specified date.

Syntax: DATENAME ( datepart, date )

Datepart: Returns an integer representing the specified datepart of the specified date.

Syntax: DATEPART ( datepart, date )

Day: Returns an integer representing the day datepart of the specified date.

Syntax: DAY ( date )

Getdate: Returns the current system date and time in the Microsoft® SQL Server™ standard internal format for datetime values.

Syntax: GETDATE ( )

Month: Returns an integer that represents the month part of a specified date.

Syntax: MONTH ( date )

Year: Returns an integer that represents the year part of a specified date.

Syntax: YEAR ( date )

Hope this would be helpful.

10 Jan
2007
Posted in: Thoughts
By    No Comments

Learning never dies

To followup with my post on SQL Tip – Row-by-row processing (http://blogs.abrahamdurairaj.info/2006/12/sql-tip-row-by-row-processing.html) I have learnt a cool technique offlate.

It is the use of COALESCE function in SQL server. You can use this function to get quicker progress in fetching & processing records row-by-row.

Quick Sample

DECLARE @EmployeeList varchar(100)

SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') +
CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1

SELECT @EmployeeList

Info. Source
http://www.sqlteam.com/item.asp?ItemID=2368

10 Jan
2007
Posted in: Personal
By    No Comments

Started writing a book …

Sounds interesting ?

Yea, thats true. I have started writing a book today. It was my wish for a long time.

To give a rough idea on what the book would host are as follows
– just my sweet moments in my life
– how I overcame difficulties
– how I got spiritual strength
– etc.

I dont know clearly the release date of my book. But my target for release is next 3 months.

Hope the book would be touch the life of millions across the globe.

3 Jan
2007
Posted in: General
By    No Comments

Happy New Year 2007

I was really happy this new year that I enjoyed it meaningfully. From our church congregation we went to selaiyur, a small village in Tambaram, Chennai, Tamil Nadu, India.

We mingled with the village people and we started to play with them. The kids at the village were happy to get prizes as they won lots of events.

It was the best new year I have ever seen in my life. All the glory goes to my Lord and Saviour Jesus Christ.