Monday, 26 September 2011

Removing Duplicate Rows from an Excel Spreadsheet

Microsoft has made this dead easy in MS Office 2010.
1. Open your spreadsheet to the worsksheet with duplicate rows
2. Switch to the 'Data' menu Ribbon
3. Click on 'Remove Duplicates'
4. This will open up a dialog where you can select the rows/columns with duplicates you want to remove.

Monday, 19 September 2011

Date additions (T-SQL)

Adding number of x to a date, where x can be: year=yy, month=m, dayofyear=y, day=d, week=wk, hour=hh, minute=mi, second=ss.

For example adding 260 days to New Year's day 2011:

print dateadd(d, 260, '2011-01-01')

 
This should return Sep 18 2011



Calculate days since begninning of the Year (T-SQL)

print datediff(d, '2011-01-01', getdate())


Or get the difference between any two dates; format is datediff(d, ealier date, later date)
e.g
.



print datediff(d, '1969-07-20', '2011-09-19')