Good Team Plays Hard
In: MS SQL
27 Apr 2010I know that we can make the MSSQL Database online and offline using the management console GUI but how about using the T-SQL? It is actually not that difficult and should be more efficient too since we can write this into a script and provide more flexibility for the startup and shutdown process. Below is [...]
In: MS SQL
30 Mar 2010Recently I was assigned to perform a data patch on the production database that involved account department and application team. The account department just provided me an excel file with pivot table and a long list of data. I need to figure out the table involve and relationship myself. What I learn from this task [...]
In this article we will go over basic understanding of Rollup clause in Oracle and SQL Server. ROLLUP clause is used to do aggregate operation on multiple levels in hierarchy. Let us understand how it works by using an example. Consider a table with the following structure and data: MSSQL CREATE TABLE tblPopulation ( Country VARCHAR(100), [...]
In: MS SQL
7 Jan 2010Creating Comma Separated Values (CSV) from Table Column is a very common task and we sometimes do it to export to excel for further massaging the data. Below is the script used on Microsoft SQL Server: USE AdventureWorks GO — Check Table Column SELECT [Name] FROM HumanResources.Shift GO — Get CSV values SELECT STUFF( (SELECT [...]
In: MS SQL
4 Jan 2010Sometimes I just forget where I setup the Data File due to multiple database being used. As you can imagine one project will have 3 database (1 Development, 1 UAT, 1 Production), so keeping track of where they are located is not as easy as it was for this old brain. Using Enterprise Manager of [...]
In: MS SQL
19 Aug 2009I have seen scores of expert developers getting perplexed with SQL Server in finding time only from datetime datatype. Let us have a quick glance look at the solution. SQL Server 2000/2005 SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond, CONVERT(VARCHAR(8),GETDATE(),101) AS DateOnly GO SQL Server 2008 SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSecond, CONVERT(DATE,GETDATE(),101) AS DateOnly GO Bookmark It Hide Sites [...]
In: MS SQL
22 Jul 2009I was asked to solve the FizzBuzz puzzle in an interview long ago. Today I got some free time so I decided to tackle this puzzle using the T-SQL and see how it goes. The interviewer ask me to write a program that prints the numbers from 1 to 100. But for multiples of 3 [...]
This is a place I create just for fun and to write down some experience and notes for myself. So feel free to enjoy and drop any comments you have. I had been employed as Programmer, System Analysts, System Administrator, DBA and Project Manager. I will share some of my case study here as well. Enjoy!