# Monday, January 3, 2005

When you want to view a web site that has a Quick Time video and you go to Apple.com to download the free Quick Time player for Windows 2000 or XP, you HAVE to install iTunes. What does iTunes have to do with QuickTime? So many move previews are done in QuickTime and Apple knows this. So they are using their dominance in one area to force something else on us. Somebody call the US Justice Department.

Anyway Apple owns the iPod market, but a years worth of iPod sales is equal to 2 weeks of Dell shipments…

posted on Monday, January 3, 2005 4:42:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments [16] Trackback
# Tuesday, December 28, 2004

Osama bin Laden formed an official alliance with the Iraqi terrorist Sunni Zarqawi yesterday and urged the minority Sunnis to protest the Jan 30th election in Iraq.

Previously bin Laden (who is a Sunni Muslim) has not been a vocal enemy against the Shiites. Remember Saddam was a minority Sunni kept in power by force and repressed the majority Shiite population. (As well as the minority Kurds.) By forming an official alliance with Zarqawi, bin Laden’s now pitting himself against the Shiite majority. (Like the good Wahhabist he really is.)

So January 30th there will be elections with or without the Sunnis. Osama bin Laden said anyone who will vote is an infidel. Just like in Afghanistan where the radical Sunni Taliban allied with bin Laden are still in their holes protesting the first freely elected leader in Afghanistan’s history, Zarqawi’s Sunni Muslims will just get more radical and blood thirsty with an alliance with bin Laden, boycott elections and live in their holes. Just like in Afghanistan, moderate Sunnis (like the moderate Sunni non Wahhabist Taliban) did not align themselves with terror and wanted to be part of the political process and laid down their arms and formed political opposition parties. Moderate Sunnis will do the same in Iraq. Sure some will stay home, but they know that the majority of the population made up of Kurds and Shiites (both previously gassed by Saddam) would rather die then not vote and will not risk staying out of the process. The Sunnis can see the writing on the wall.

Will Zarqawi’s terror continue? Unfortunately yes. How do we stop them? Hold free elections January 30th and give the people a stake in their government. Zarqawi’s Sunni “insurgent” group is not an “insurgency” but just a radical group of terrorists opposed to democracy-as his alliance with bin Laden now proves. Let’s now call a spade a spade and label his group terrorists. His legitimacy has sunk even lower with moderate Sunnis with the bin Laden alliance. As democracy grows in Iraq over time Zarqawi’s group will diminish. It will take time, maybe years as it did in Afghanistan.

Lastly, we need not worry about Iran, the Shiite power next door. Elected moderate Iraqi Shiites will reject the radical non democratic and non Arab (Iranians are not Arabs, Iraqis are). Moderate Sunnis will come to the forefront and Zarqawi’s Sunni terrorists will eventually be isolated and marginalized, just like the radical Taliban were in Afghanistan. It took only three years in Afghanistan-give Iraq time.

Fast forward 10 years from now. A democratically elected free Afghanistan, Palestine and Iraq.

posted on Tuesday, December 28, 2004 12:16:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [16] Trackback
# Wednesday, December 22, 2004

SQL Server 2005 introduces an enhancement to the OPENROWSET function, the new BULK rowset OLE DB provider. Via OPENROWSET, it lets you access data in files in a relational fashion. In the past, you used BULK INSERT to pull data from the file into a temp table and then ran your relational operations, but with SQL Server 2005, you can use the data contained in the file as part of your SQL statement rowset results. Keep in mind that you must specify a format file, which is the same format file you use with bcp.exe or the BULK INSERT statement. The following code shows how to access a file named c:\bulk.txt using the format file c:\bulk.fmt:

SELECT customerid, customername, totalorders


       FORMATFILE = 'c:\bulk.fmt') AS (customerid, customername, totalorders)

posted on Wednesday, December 22, 2004 8:27:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments [16] Trackback
# Tuesday, December 21, 2004

SQL Server 2005 adds a new feature called Common Table Expressions (CTE). The true power of CTEs emerges when you use them recursively to perform hierarchical queries on tree structured data. In fact, besides SQL-92 compliance, this was the main reason Microsoft built CTEs. A recursive CTE is constructed from a minimum of two queries, the first, or anchor member (AM), is a nonrecursive query, and the second, or recursive member (RM), is the recursive query. Within your CTE’s parentheses (after the AS clause), you define queries that are either independent or refer back to the same CTE. The AM and RM are separated by a UNION ALL statement. Anchor members and are invoked only once and are invoked repeatedly until the query returns no rows. Multiple AMs can be appended to each other using either a UNION or a UNION ALL operator, depending on whether you want to eliminate duplicates. (You must append recursive members using a UNION ALL operator.)  Here is the syntax:

With SimpleRecursive( field names)



     <Select Statement for the Anchor Member>


     Union All


     <Select Statement for the Recursive Member>



Select * From SimpleRecursive


To demonstrate this feature, I will create an example here. We create a table with employees and a self referencing  field back to Employee_ID called ReportsTo (I call this a Domestic Key in lue of a Foreign Key). We are going to write a query that returns all the employees who report to Stephen (Employee_ID=2) and all the employees who report to Stephen’s subordinates: 

--create a table with tree data

--Reportsto is a "domestic key" back to Employee_id

create table Employee_Tree (Employee_NM nvarchar(50), Employee_ID int Primary Key, ReportsTo int)

--insert some data, build a reporting tree

insert into employee_tree values('Richard', 1, 1)

insert into employee_tree values('Stephen', 2, 1)

insert into employee_tree values('Clemens', 3, 2)

insert into employee_tree values('Malek', 4, 2)

insert into employee_tree values('Goksin', 5, 4)

insert into employee_tree values('Kimberly', 6, 1)

insert into employee_tree values('Ramesh', 7, 5)


Our table looks like this:


























Now the recursive query to determine all the employees who will report to Stephen:


--Recursive Query

WITH SimpleRecurvice(Employee_NM, Employee_ID, ReportsTO)


(SELECT Employee_NM, Employee_ID, ReportsTO

  FROM Employee_Tree WHERE Employee_ID = 2


SELECT p.Employee_NM, p.Employee_ID, p.ReportsTO

 FROM Employee_Tree  P  INNER JOIN

 SimpleRecurvice A ON A.Employee_ID = P.ReportsTO


SELECT Employee_NM FROM SimpleRecurvice










(5 row(s) affected)

This recursion starts where Employee_ID= 2 (the ANCHOR MEMBER or the first SELECT). It picks up that record and then, via the RECURSIVE MEMBER (the SELECT after the UNION ALL), picks up all of the records that report to Stephen and that record’s children (Goksin reports to Malek and Malek reports to Stephen). Each subsequent recursion tries to find more children that have as parents the employees found by the previous recursion. Eventually the recursion returns no results and that is what causes the recursion to stop (the reason why Kimberly is not returned).

posted on Tuesday, December 21, 2004 8:51:18 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1] Trackback
# Thursday, December 16, 2004

Clemens arrives tomorrow and this can't be good....

posted on Thursday, December 16, 2004 4:04:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [10] Trackback
# Tuesday, December 14, 2004

I stated using Google proper (www.google.com) since it was faster (and still is) to type in DataReader.Read() into Google and get to the MSDN page than search MSDN itself. This was back in about 2000 when Google released the www.google.com/microsoft.html page that indexes all the Microsoft specific sites (including blogs and 3rd party sites besides MSDN content).   


I installed the Google toolbar as well as the Yahoo, A9 and MSN toolbars and played with them the best I could, but I always came back to Google. Until after its IPO, it removed the “search Microsoft” from its drop down list and I had to bookmark www.google.com/microsoft.html.


I was very excited about Google Desktop and installed it right away. I was marginally impressed. I did not like the web interface-why bother with creating a web server on the user’s machine, if you are going to install custom software why not something easier to manage? That said I started to use it anyway. After some time of using it I came to notice that all I was really concerned with was email and attachments in email, so on the advice of Adam Cogan (gulp) I installed Lookout (which Microsoft has since purchased) and used that extensively-as it is better than Google Desktop for email searches and it integrated into Outlook, I even uninstalled Google Desktop from machine.


So when Microsoft yesterday announced the new MSN toolbar that also performed Desktop Search I was not immediately excited. Like the curious cat that I am, I installed it anyway.


I was surprised! MSN Toolbar/Desktop Search is a far superior product than Google Desktop (and Lookout). Here is why:


The toolbars have the same functionality but Google took about 3 days to archive and MSN about an hour.

MSN search has English Questions Ask it: “What is the capital of the Netherlands” and Encarta will come up along with the answer as well as web links below it. Google just has links.

 MSN has superior local search, but Google is catching up fast.

**Google does have that super cool autcomplete in beta and announced today that it was scanning in textbooks and university libraries.

True Google has Newsgroup archives, but I rarely ever use that-old Newsgroups are not as interesting to me as current ones which now MSN can do via indexing Outlook Express (you have to subscribe to them first though)


Using MSN Toolbar on the desktop is great. I usually don’t have this sort of reaction to software. It has autocomplete and immediate feedback as you type. I typed in “Clem” and it knew I was searching for Clemens Vasters.

It is super smart and real fast. It even indexes data better than Google. It even picked up an XML file of some old sample data from a Conference-Google Desktop did not.


It is still in beta and not perfect (why not index .CS files???), but I am already using it as my main search for the web and desktop. I had been hard code Google user for 4 years-it has not come to an end. 

posted on Tuesday, December 14, 2004 5:59:41 PM (Eastern Standard Time, UTC-05:00)  #    Comments [12] Trackback
# Monday, December 13, 2004

Come one, come all, this Thursday at the NYC .NET Developers Group, Andrew, Bill and I will give a real in-depth sneak peak on SQL Server 2005 including a tools overview, TSQL, XQuery,XML, Service Broker, OLAP and the Unified Demensional Model. Too bad Clemens will not be there, he is arriving on Friday and spending the weekend at my place for some year end partying. Maybe we will rewrite dasBlog to use SQL Server 2005. (Most likely we will just drink a lot and fall down.)

Did another race this weekend, 10K in Central Park. 8:39 pace, no way I can hold that up for an entire marathon.

Last Name

First Name


























posted on Monday, December 13, 2004 10:41:30 AM (Eastern Standard Time, UTC-05:00)  #    Comments [9] Trackback
# Friday, December 10, 2004


The ranking functions can also combine with windowing functions. A windowing function will divide a resultset into equal partitions based on the values of your PARTITION BY statement in conjunction with the OVER clause in your ranking function. It is like applying a GROUP BY to your ranking function-you get a separate ranking for each partition. The example below uses ROW_NUMBER with PARTITION BY to count the number of orders by order date by salesperson. We do this with a PARTITION BY SalesPersonID OVER OrderDate. This can be used with any of the four ranking functions.

Select SalesOrderID, SalesPersonID, OrderDate,

Row_NUMBER() Over (Partition By SalesPersonID Order By OrderDate) as OrderRank

From Sales.SalesOrderHeader

Where SalesPersonID is not null


SalesOrderID SalesPersonID OrderDate               OrderRank

------------ ------------- ----------------------- ---

43659        279           2001-07-01 00:00:00.000 1

43660        279           2001-07-01 00:00:00.000 2

43681        279           2001-07-01 00:00:00.000 3

43684        279           2001-07-01 00:00:00.000 4

43685        279           2001-07-01 00:00:00.000 5

43694        279           2001-07-01 00:00:00.000 6

43695        279           2001-07-01 00:00:00.000 7

43696        279           2001-07-01 00:00:00.000 8

43845        279           2001-08-01 00:00:00.000 9

43861        279           2001-08-01 00:00:00.000 10

. . . More

48079        287           2002-11-01 00:00:00.000 1

48064        287           2002-11-01 00:00:00.000 2

48057        287           2002-11-01 00:00:00.000 3

47998        287           2002-11-01 00:00:00.000 4

48001        287           2002-11-01 00:00:00.000 5

48014        287           2002-11-01 00:00:00.000 6

47982        287           2002-11-01 00:00:00.000 7

47992        287           2002-11-01 00:00:00.000 8

48390        287           2002-12-01 00:00:00.000 9

48308        287           2002-12-01 00:00:00.000 10

. . . More


PARTITION BY supports other SQL Server aggregate functions including MIN and MAX.


posted on Friday, December 10, 2004 8:47:01 AM (Eastern Standard Time, UTC-05:00)  #    Comments [9] Trackback