April 2005 - Posts

Developer webcasts in Spanish

This site has announcements on developer webcasts in Spanish, with emphasis on Visual Studio 2005 and SQL Server 2005 ¡Pasen la voz!

Webcast: Clientes inteligentes con Windows Forms 2.0

First of all, I must apologize because, due to technical problems, we weren't able to present live last week webcast (De ASP.NET 1.1 a ASP.NET 2.0). I hope this time we don't have any problems.
 
Today, Tuesday April 19 2005, starting at 2 P.M. Eastern Time (GMT -5), that is 13h00 in Panamá-Bogotá-Quito-Lima, I'll be doing a webcast on the development of smart clients using Windows Forms 2.0. You can register and then join the presentation at http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032273483&Culture=es-MX. Once again, I hope and pray we can go live without problems this time.

Webcast: De ASP.NET 1.1 a ASP.NET 2.0

Following the trend of Roy Osherove about webcasts and other activities in Hebrew, I hereby announce my very own personal webcast, but in Spanish: De ASP.NET 1.1 a ASP.NET 2.0. If you've seen any decent ASP.NET 2.0 presentation (or better yet, you're developing with it), you won't really see anything new. But if you want to know how we translate web form or how I pronounce "Visual Studio" or "cache" in (Latin American) Spanish then come watch this presentation, I think you'll find it amusing.

Update: due to internal difficulties, the page that works as gateway to the webcast got broken :-( But I did the webcast anyway and it was recorded, I'm told the recording will go public some day next week. I'll post the URL as soon as I have it.

 

Posted by Edgar Sánchez with 2 comment(s)
Filed under:

CTEs in SQL Server 2005

SQL Server 2005 brings a handful of interesting enhancements inside TSQL Data Manipulation Language. An example:

Let's say that on the good old Northwind Products table we are asked to separate the products by price in three groups; we have to take the maximum price and define three sections: from 0 to 1/3 of the max, from 1/3 to 2/3 of the max, and from 2/3 to the max. Now, we are asked to show the prices of all the products in the middle section along with its difference from the lower limit (1/3 of the max price).

On SQL Server 2000, you could solve it like this:


declare @low money
declare @high money

SELECT @low = ((MAX(UnitPrice)) / 3)
  FROM Products

SELECT @high = (2 * MAX(UnitPrice) / 3)
  FROM Products

SELECT ProductId, ProductName, UnitPrice, UnitPrice - @low
 FROM Products
 WHERE Products.UnitPrice > @low
 AND Products.UnitPrice <= @high

On SQL Server 2005, you can solve it like this:


WITH low AS (SELECT ((MAX(UnitPrice)) / 3)
  AS value FROM Products),
high AS (SELECT (2 * MAX(UnitPrice) / 3)
  AS value FROM Products)
SELECT ProductId, ProductName, UnitPrice, UnitPrice - low.value,
 FROM Products, low, high
 WHERE Products.UnitPrice > low.value
 AND Products.UnitPrice <= high.value

Note the WITH clause which, in this case, define two CTEs (Common Table Expressions): low and high. These CTEs behave like temporary tables (allowing us to do joins, etc.) but in fact they are just resultsets, so they are more efficient than temp tables. The notation is also more compact, and furthermore, it can be used to define a view.

Posted by Edgar Sánchez with no comments
Filed under:
More Posts