Wednesday, November 18, 2009

Silverlight 4 Beta - developer release

http://silverlight.net/getstarted/silverlight-4-beta/

"This latest version delivers hundreds of features and controls that, when combined with the continued innovation in Microsoft’s world-class tools for designers and developers — Microsoft Visual Studio and Microsoft Expression Blend – present the leading edge in rapid, powerful application development. With printing support, rich reporting and charting, and integration with back-end systems and server products including Microsoft SharePoint, Silverlight is ready for business."

"IMPORTANT DEVELOPER NOTE:

Visual Studio 2010 can be installed side-by-side with Visual Studio 2008 SP1. For Silverlight 4 development, you will need Visual Studio 2010. Please read the known issue on installing Visual Studio 2010 if you already have the Silverlight 3 SDK installed."

Videos and Samples
http://silverlight.net/learn/videos/silverlight-4-beta-videos/
Share/Bookmark

Sunday, November 8, 2009

T-SQL - NULL does not equal NULL

Be careful of this when coding. NULL does not equal NULL, you can test it with following code, weird? No! because NULL does not present a value to be able to be equal to another value!

IF (NULL=NULL)
PRINT 'NULL is equal to NULL'
ELSE
PRINT 'NULL is not equal to NULL !'

Share/Bookmark

Saturday, November 7, 2009

T-SQL - Aggregate functions and NULL values in numeric fields

Except COUNT(*), all other aggregate functions ignore NULLs. As an example if you have NULL value in a numeric field, the NULL value does not equal to zero. Look at the following code, it shows the AVG function ignores the records which their specific column has NULL value.

CREATE TABLE theTable
(
theId int IDENTITY NOT NULL,
theValue DECIMAL(10,2) NULL
)

INSERT INTO theTable
(theValue)
VALUES
(NULL), (0), (1), (2), (3), (NULL)

SELECT AVG(theValue) as AverageValue
FROM theTable

The result is 1.500000

It's important when you want to design your database and tables, because it will affect the queries result when you run them against the database.

On the other hand, it's possible to consider COALESCE function (http://msdn.microsoft.com/en-us/library/ms190349.aspx), it gives you a chance to select first non NULL expression among its arguments. Then you can send multiple field names and let the COALESCE find the first non NULL value for your aggregate function, it can be happen if you have alternative field but it's tricky and depends on business rules in your application.
Share/Bookmark