Understanding and Using PIVOT clause in SQL Server 2005

February 7, 2009 03:48 by akashheranjal
SQL Server 2005 has lots of new features, of which one is PIVOT clause. This is similar to Pivot tables in MS Excel and Matrix Control in Reporting Service. Here is a simple example demonstrating how to use PIVOT clause. I am right now taking a simple example. There are scenarios where there could be a need to write a big stored procedure to build a Pivot table in lower versions of SQL Server. [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Another way to export SQL Server table data to a Text file

January 1, 2009 21:01 by akashheranjal
No doubt that a DTS or SSIS package can be used to export SQL Server table data to a text file. The below article is to demonstrate another way to export SQL Server table data to a text file using xp_cmdshell extended stored procedure (This is with reference to SQL Server 2005 and above). [More]

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Converting Row Data as Comma Separated String

December 29, 2008 06:02 by akashheranjal
One of my office mate Ranjan Patra did some research on internet and found a simple and quick solution to have row data as comma separated string. [More]

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

How to select random rows from an SQL Table?

December 22, 2008 09:52 by akashheranjal
IN SQL Server, it is easy to select one random record or a sequence of random records from a database table. For example if you have requirement to pick a single quiz winner randomly from the database table or you are making an online test application and need to pick X number of questions randomly from the database table; you can certainly use the below SQL queries… [More]

Currently rated 4.0 by 2 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

How to eliminate duplicate records from a database table?

December 20, 2008 05:00 by akashheranjal
This is a general problem faced by a maintenance team. While importing or exporting data to or from or between databases, the PK is removed accidentally and the table now has lots of duplicate records. The big question for the support staff is how to clean the database? It's simple... [More]

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5