Tuesday, June 30, 2015

Rebuild all Indexes on a Microsoft SQL Server

As part of database maintenance, a DBA may wish to do periodical rebuild of all indexes. The below may come handy.
EXEC sp_MSForEachTable 'ALTER INDEX ALL ON ? REBUILD'

Monday, June 29, 2015

President Obama 'AMAZING GRACE' Eulogy For Clementa Pickney

President Obama delivered a 40-minute 'AMAZING GRACE' eulogy for Clementa Pickney who was murdered by a racist terrorist on June 17, 2015 at an evening Bible study at his church. This touching speech is a thoughtful meditation on the whites and blacks race in America.

Watch the video below:

Thursday, May 28, 2015

NDP 2015 Theme Song: Our Singapore

The theme song, written by Dick Lee, for this year's National Day is released.


How do you feel about this song? For your pleasure, I have consolidated all NDP theme songs from 1998 to 2013.

Friday, April 17, 2015

Chen Tianwen's un-un-un-un-unbelievable song got a remix

The famous Mediacorp's 'Spouse For House' actor Chen Tianwen music video "Un. un. un. un. unbelievable!!!" now comes with a remix version.


If you are interested to listen to the original version, do check out this link!

Wednesday, April 15, 2015

MsSQL Split Function

The following demonstrates how to do a string Split using a character delimiter.

--SQL function to do split
CREATE FUNCTION [dbo].[Split]
(
 @RowData NVARCHAR(MAX),
 @SplitOn CHAR(1)
)  
RETURNS @RtnValue TABLE
(
 ID INT IDENTITY(1,1),
 Data VARCHAR(MAX)
) 
AS
BEGIN
 DECLARE @count INT
 SET @count = 1

 WHILE (CHARINDEX(@SplitOn COLLATE Latin1_General_100_BIN2, @RowData) > 0)
 BEGIN
  INSERT INTO @RtnValue (data)
  SELECT Data = LTRIM(RTRIM(SUBSTRING(@RowData, 1, CHARINDEX(@SplitOn COLLATE Latin1_General_100_BIN2, @RowData) - 1)))
  SET @RowData = SUBSTRING(@RowData, CHARINDEX(@SplitOn COLLATE Latin1_General_100_BIN2, @RowData) + 1, LEN(@RowData))
  SET @count = @count + 1
 END

 INSERT INTO @RtnValue (data)
 SELECT Data = LTRIM(RTRIM(@RowData))

 RETURN
END
GO
--Test out the SQL function
SELECT * FROM dbo.Split('one|two|three|four', '|')
GO

So stunned like a vegetable by Chen Tianwen's "Un. un. un. un. unbelievable!!!" music video

Mediacorp's 'Spouse For House' actor Chen Tianwen music video "Un. un. un. un. unbelievable!!!" is so unbelievably funny. What a multi-talented guy.


Spouse For House airs every Wednesday, 10pm on Channel 5.

Blog Archive

Related Posts Plugin for WordPress, Blogger...