h1

Retrieving Unique Values from a DataTable in .NET

March 25, 2009

The easiest way to return a new table that has only the unique values from the original table is as follows:

DataTable distinctTable = originalTable.DefaultView.ToTable(true, “FieldName”);
Thus “distinctTable” will contain unique values!!! :) Have fun!

h1

Using Variables in T-SQL Statements that accept only constant values

December 31, 2008

Developers usually come across a situation wherein they would want to use a variable in a T-SQL Statement which accepts only constant values.

For example, if we try to assign a variable to a Select Top <@variable_name> statement, we would get an error like:

Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ‘@variable_name’

There is a work around this problem though. The below stored procedure  solves it:

CREATE PROCEDURE TEST
@TestInt INT

AS

BEGIN

DECLARE @SqlQuery NVARCHAR(4000);

SET @SqlQuery = ‘SELECT TOP ‘+CAST(@TestInt as CHAR)+’* FROM TABLE_TEST’;

EXEC(@SqlQuery)

END

h1

Formatting DateTime in SQL Server

October 23, 2008

As a Developer, you would come across a scenario where you would want SQL Server to return DateTime in a particular format to the front end. You can use SQL Server’s built in function GETDATE() to return the current DateTime. But if you need a universal date/time, use the built-in function GETUTCDATE(). SQL Server provides format numbers to format the date/time string returned. All you need to do is convert the specific date to a string and specify the format number corresponding to your required format.

Below is a list of  few Date formats and their corresponding outputs:

Date Formats
Format No. SQL Query Output
1 select convert(varchar, getdate(), 1) 12/30/06
2 select convert(varchar, getdate(), 2) 06.12.30
3 select convert(varchar, getdate(), 3) 30/12/06
4 select convert(varchar, getdate(), 4) 30.12.06
5 select convert(varchar, getdate(), 5) 30-12-06
6 select convert(varchar, getdate(), 6) 30 Dec 06
7 select convert(varchar, getdate(), 7) Dec 30, 06
10 select convert(varchar, getdate(), 10) 12-30-06
11 select convert(varchar, getdate(), 11) 06/12/30
101 select convert(varchar, getdate(), 101) 12/30/2006
102 select convert(varchar, getdate(), 102) 2006.12.30
103 select convert(varchar, getdate(), 103) 30/12/2006
104 select convert(varchar, getdate(), 104) 30.12.2006
105 select convert(varchar, getdate(), 105) 30-12-2006
106 select convert(varchar, getdate(), 106) 30 Dec 2006
107 select convert(varchar, getdate(), 107) Dec 30, 2006
110 select convert(varchar, getdate(), 110) 12-30-2006
111 select convert(varchar, getdate(), 111) 2006/12/30

Below is a list of few Time formats and their corresponding outputs:

Time Formats
Format No. SQL Query Output
8 or 108 select convert(varchar, getdate(), 8 ) 00:38:54
9 or 109 select convert(varchar, getdate(), 9) Dec 30 2006 12:38:54:840AM
14 or 114 select convert(varchar, getdate(), 14) 00:38:54:840
h1

The Lone Wolf Will be back!

September 14, 2008

Tried to post about my feelings for a very long time…. But always felt weak when my fingers got to type them…. One day when I feel I am strong enough for it…. I will POST….

h1

Belated Birthday Wishes Dear One!

July 29, 2008

Birthday Cake for my kuttapi... my luttapi... my kanmani...

Wish all your dreams come true and you stay Happy forever! :)

h1

Balaji Hatricks!

May 11, 2008

Lakshmipathy Balaji Image

He is back! Yes, the forgotten figure of Indian Cricket, Lakshmipathy Balaji is back with a bang! It must have been the worst 2-3 years of his life after being out of action due to an injury! Part of The Chennai Super Kings in the IPL, he was the Man who did the damage to the Kings XI Punjab returning with figures of 4-0-24-5 which also included a hatrick – The First in the IPL!!!

The best part was 4 of the 5 wickets were crucial important wickets, the first being Shaun Marsh who was looking dangerous with a 38 ball 58 which included 3 fours and 4 sixes! The next to go was Ramnaresh Sarwan who can take the game away from anytime if he gets his eye in! The were the 2 inportant wickets he had taken in his first spell!

On his comeback spell he had taken the wiket of Irfan Pathan who was looking very very dangerous with a 18 ball 40 which included 3 fours and 3 sixes!!! The next ball saw Piyush Chawla packing his bags!

Next was the hatrick ball. You would have thought that VRV Singh would have a brain that matched his body size, but instead he went for a wild swing which saw him top edge the ball high into the sky which Dhoni had no problems pouching!

That hatrick brought the familiar Wide Smile in Balaji’s face which had been missing for soooo long!

What was to note that being a medium fast bowler, he had bowled throughout in the 95 – 120 kmph mark and never crossed it…. All his wickets were with these slower deliveries! Now isn’t that beautiful!!!

To View The Hatrick Video Click Here

To Check out Balaji’s profile Click Here

h1

India Launches World Record 10 Satellites!

April 28, 2008

PSLV

Today, April 28th 2008, India’s 230 tonne Polar Satellite Launch Vehicle (PSLV-C9) successfully placed ten satellites, including the country’s remote sensing satellite, into orbit in a single mission, thus setting up a world record!

Click here to see the Video

The ten pack launch of the Indian Space Research Organisation (ISRO) saw the 230-tonne Polar Satellite launch Vehicle (PSLV-C9) carry the heaviest luggage–824 kgs–and put into orbit an Indian Mini Satellite and eight foreign nano satellites besides the Cartosat-2A remote sensing satellite.

Click Here to Read the Full Report

This is surely a Proud Moment for every Indian!

h1

Bhajji Slaps Sreesanth!!!

April 26, 2008

Sreesanth Crying

Harbhajan allegedly slapped Sreesanth after Mumbai Indians lost their IPL match to Kings XI Punjab last night and the paceman was seen bitterly crying on the field reports The Times of India.

Upset over the row between Mumbai Indians stand-in captain Harbhajan Singh and Kings XI Punjab paceman S Sreesanth, Indian Premier League Chairman Lalit Modi on Saturday said it was a “serious matter” and was not good for the cash-rich Twenty20 tournament.

But Modi said the IPL committee would wait for an official report on the matter before deciding about their next action in the issue.

Click Here to Read the whole report

Sreesanth on the other hand has no intention of complaining and says bhajji had apologised to him in the dressing room and that he had the right to do what he did!!!

Click Here to View the Interview with Sreesanth

In my view no matter what, nobody is entitled to physically assault anyone off the field or on it no matter how good a player you are!!!

What are your views people? Do Comment!

h1

Indian Premier League

April 18, 2008

The much hyped and awaited multi-million dollar IPL starts today, Friday 18 2008, with the Bangalore Royal Challengers Captained by Rahul Dravid taking on Kolkata Knight Riders captained by Sourav Ganguly in the opener!

Here is the complete schedule:

Date & Time Match Ground
Friday 18th April, 8:00 pm Bangalore Royal Challengers vs Kolkata Knight Riders Bangalore
  ———-  
Saturday 19th April, 5:00 pm Kings XI Punjab vs Chennai Super Kings Mohali
Saturday 19th April, 8:30 pm Delhi Daredevils vs Rajasthan Royals Delhi
  ———-  
Sunday 20th April, 4:00 pm Kolkata Knight Riders vs Deccan Chargers Kolkata
Sunday 20th April, 8:00 pm Mumbai Indians vs Bangalore Royal Challengers Mumbai
  ———-  
Monday 21st April, 8:00 pm Rajasthan Royals vs Kings XI Punjab Jaipur
  ———-  
Tuesday 22nd April, 8:00 pm Deccan Chargers vs Delhi Daredevils Hyderabad
  ———-  
Wednesday 23rd April, 8:00 pm Chennai Super Kings vs Mumbai Indians Chennai
  ———-  
Thursday 24th April, 8:00 pm Deccan Chargers vs Rajasthan Royals Hyderabad
  ———-  
Friday 25th April, 8:00 pm Kings XI Punjab vs Mumbai Indians Mohali
  ———-  
Saturday 26th April, 4:00 pm Chennai Super Kings vs Kolkata Knight Riders Chennai
Saturday 26th April, 8:00 pm Bangalore Royal Challengers vs Rajasthan Royals Bangalore
  ———-  
Sunday 27th April, 4:00 pm Kings XI Punjab vs Delhi Daredevils Mohali
Sunday 27th April, 8:00 pm Mumbai Indians vs Deccan Chargers Mumbai
  ———-  
Monday 28th April, 8:00 pm Bangalore Royal Challengers vs Chennai Super Kings Bangalore
  ———-  
Tuesday 29th April, 8:00 pm Kolkata Knight Riders vs Mumbai Indians Kolkata
  ———-  
Wednesday 30th April, 8:00 pm Delhi Daredevils vs Bangalore Royal Challengers Delhi
  ———-  
Thursday 1st May, 4:00 pm Rajasthan Royals vs Kolkata Knight Riders Jaipur
Thursday 1st May, 8:00 pm Deccan Chargers vs Kings XI Punjab Hyderabad
  ———-  
Friday 2nd May, 8:00 pm Chennai Super Kings vs Delhi Daredevils Chennai
  ———-  
Saturday 3rd May, 4:00 pm Bangalore Royal Challengers vs Deccan Chargers Bangalore
Saturday 3rd May, 8:00 pm Kings XI Punjab vs Kolkata Knight Riders Mohali
  ———-  
Sunday 4th May, 4:00 pm Mumbai Indians vs Delhi Daredevils Mumbai
Sunday 4th May, 8:00 pm Rajasthan Royals vs Chennai Super Kings Jaipur
  ———-  
Monday 5th May, 8:00 pm Bangalore Royal Challengers vs Kings XI Punjab Bangalore
  ———-  
Tuesday 6th May, 8:00 pm Chennai Super Kings vs Deccan Chargers Chennai
  ———-  
Wednesday 7th May, 8:00 pm Mumbai Indians vs Rajasthan Royals Mumbai
  ———-  
Thursday 8th May, 4:00 pm Delhi Daredevils vs Chennai Super Kings Delhi
Thursday 8th May, 8:00 pm Kolkata Knight Riders vs Bangalore Royal Challengers Kolkata
  ———-  
Friday 9th May, 8:00 pm Rajasthan Royals vs Deccan Chargers Jaipur
  ———-  
Saturday 10th May, 8:00 pm Chennai Super Kings vs Kings XI Punjab Chennai
  ———-  
Sunday 11th May, 4:00 pm Deccan Chargers vs Kolkata Knight Riders Hyderabad
Sunday 11th May, 8:00 pm Rajasthan Royals vs Delhi Daredevils Jaipur
  ———-  
Monday 12th May, 8:00 pm Kings XI Punjab vs Bangalore Royal Challengers Mohali
  ———-  
Tuesday 13th May, 8:00 pm Kolkata Knight Riders vs Delhi Daredevils Kolkata
  ———-  
Wednesday 14th May, 8:00 pm Mumbai Indians vs Chennai Super Kings Mumbai
  ———-  
Thursday 15th May, 4:00 pm Delhi Daredevils vs Deccan Chargers Delhi
  ———-  
Friday 16th May, 8:00 pm Mumbai Indians vs Kolkata Knight Riders Mumbai
  ———-  
Saturday 17th May, 4:00 pm Rajasthan Royals vs Bangalore Royal Challengers Jaipur
Saturday 17th May, 8:00 pm Delhi Daredevils vs Kings XI Punjab Delhi
  ———-  
Sunday 18th May, 4:00 pm Kolkata Knight Riders vs Chennai Super Kings Kolkata
Sunday 18th May, 8:00 pm Deccan Chargers vs Mumbai Indians Hyderabad
  ———-  
Monday 19th May, 8:00 pm Bangalore Royal Challengers vs Delhi Daredevils Bangalore
  ———-  
Tuesday 20th May, 8:00 pm Kolkata Knight Riders vs Rajasthan Royals Kolkata
  ———-  
Wednesday 21st May, 4:00 pm Mumbai Indians vs Kings XI Punjab Mumbai
Wednesday 21st May, 8:00 pm Chennai Super Kings vs Bangalore Royal Challengers Chennai
  ———-  
Thursday 22nd May, 8:00 pm Delhi Daredevils vs Kolkata Knight Riders Delhi
  ———-  
Friday 23rd May, 8:00 pm Kings XI Punjab vs Deccan Chargers Mohali
  ———-  
Saturday 24th May, 4:00 pm Chennai Super Kings vs Rajasthan Royals Chennai
Saturday 24th May, 8:00 pm Delhi Daredevils vs Mumbai Indians Delhi
  ———-  
Sunday 25th May, 4:00 pm Deccan Chargers vs Bangalore Royal Challengers Hyderabad
Sunday 25th May, 8:00 pm Kolkata Knight Riders vs Kings XI Punjab Kolkata
  ———-  
Monday 26th May, 8:00 pm Rajasthan Royals vs Mumbai Indians Jaipur
  ———-  
Tuesday 27th May, 8:00 pm Deccan Chargers vs Chennai Super Kings Hyderabad
  ———-  
Wednesday 28th May, 4:00 pm Bangalore Royal Challengers vs Mumbai Indians Bangalore
Wednesday 28th May, 8:00 pm Kings XI Punjab vs Rajasthan Royals Mohali
  ———-  
Friday 30th May, 8:00 pm 2nd Semi-Final Mumbai
  ———-  
Saturday 31st May, 8:00 pm 1st Semi-Final Mumbai
  ———-  
Sunday 1st June, 8:00 pm Final Mumbai

These are the Official IPL Websites:

Indian Premier League: http://www.indianpremierleague.com
Bangalore Royal Challengers: http://www.royalchallengers.com
Chennai Super Kings: http://www.chennaisuperkings.com
Delhi Dare Devils: http://www.delhidaredevils.com
Hyderabad Deccan Chargers: http://www.deccanchargers.com
Jaipur Rajasthan Royals: http://www.rajasthanroyals.com
Kolkata Knight Riders: http://www.kolkataknightriders.com
Mohali Kings XI Punjab: http://www.kingsxipunjab.com
Mumbai Indians: http://www.themumbaiindians.com
h1

Maggie Noodles for just Re.1

April 18, 2008

Hey guys and gals! The Value Mart store in Storrz.com is offering Maggie Noodles which costs Rs.10 for just Re.1… But the rest of the items in the Value Mart Store can be shopped only by Bangaloreans… If you need to shop for other products you need to first select your city from the Drop Down List provided in the home page!

NOTE: They deliver only one item per person per address! So dont add more than one Re.1 product as they might reject it!

Click Here to check out the offer!