If you find this article useful, consider making a small donation to show your support for this web site and its content.
DiscountASP
AboutMe
About me:
Hi. My name is Farooq Kaiser and I'm a software developer from Toronto, Canada.

Building a T-SQL Loop

by Farooq Kaiser 12. June 2009 14:04
This topic shows how to write Nested loop with table variable instead of cursors. This tutorial will use AdventureWorks database.  DECLARE @COUNTER AS INT DECLARE @TOTALREC AS INT DECLARE @RESULT_TABLE TABLE ( RES_ID INT, R... [More]

Be the first to rate this post

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

Tags: ,

SQL

Ranked Results with MS SQL

by Farooq Kaiser 3. June 2009 14:56
Recently, I created a report using SSRS and i found ROW_NUMBER() can be very useful in rank-related tasks.Here is a sample query using AdventureWorks database. Select ProductID, ReorderPoint , SafetyStockLevel,ROW_NUMBER() OVER (order by ProductID) as RowFROM Production.Product&n... [More]

Be the first to rate this post

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

Tags: ,

SQL

Using PIVOT and UNPIVOT with SQL 2005/2008

by Farooq Kaiser 31. May 2009 11:54
The PIVOT operator can be used to transform a set of rows into columns while the UNPIVOT operator complements the PIVOT operator by allowing you to turn columns into rows. The following sample will use AdventureWorks database.Sample CodeUSE AdventureWorks GOSELECT DaysToManufacture, sum(StandardCost... [More]

Be the first to rate this post

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

Tags: ,

SQL

Jobs Autos Real estate Videos Power by Google