Categories: Datenbanken, SQL Server 2005, Sql Server 2005 Express, DotNetHeute, German Posted by AlexanderZeitler on 5/21/2006 1:53 PM | Comments (2)

Thomas stand ja kürzlich vor dem Problem, eine CTE hierarchisch korrekt ausgeben zu wollen, was ihn zu Niels Berglund führte (Sorting Hierarchical CTE's).

Allerdings blieb ein Problem: Die Daten sind nun zwar hierarchisch sortiert - nicht jedoch alphabetisch innerhalb der Hierarchie.

Heute stand ich schließlich vor dem gleichen Problem - und ich glaube, ich habe eine Lösung gefunden ;-)

Ausgehend von einer Tabelle Kategorien, welche die Felder Name (nvarchar), ID (uniqueidentifier) und Parent (uniqueidentifier) besitzt, sollen also die Kategorien hierarchisch und alphabetisch dargestellt werden:

Korrekt wäre also z.B.:

Name ID Parent
Rohre und Formteile C55C8856-6205-4F76-A15A-6FCD4A68A831 00000000-0000-0000-0000-000000000000
Geschweißte Rohre und Formteile 9EEE0951-4E63-4494-BB18-88BCC1D4A3E5 C55C8856-6205-4F76-A15A-6FCD4A68A831
Rohrbögen geschweißt 8A137449-6108-47D2-8ED0-AE0EA4176EB2 9EEE0951-4E63-4494-BB18-88BCC1D4A3E5
Rohre geschweißt 085A0AA3-AB9D-4DD1-9739-77040E627445 9EEE0951-4E63-4494-BB18-88BCC1D4A3E5

Erhalten habe ich mit Niels' Lösung jedoch nur:

Name ID Parent
Rohre und Formteile C55C8856-6205-4F76-A15A-6FCD4A68A831 00000000-0000-0000-0000-000000000000
Geschweißte Rohre und Formteile 9EEE0951-4E63-4494-BB18-88BCC1D4A3E5 C55C8856-6205-4F76-A15A-6FCD4A68A831
Rohre geschweißt 085A0AA3-AB9D-4DD1-9739-77040E627445 9EEE0951-4E63-4494-BB18-88BCC1D4A3E5
Rohrbögen geschweißt 8A137449-6108-47D2-8ED0-AE0EA4176EB2 9EEE0951-4E63-4494-BB18-88BCC1D4A3E5

 

Nach einigem Experimentieren mit Views u.ä. bin ich auf folgende Lösung gekommen:

WITH CTE([Name], ID, ordercol, Parent)
AS
(
    SELECT [Name], ID, cast([Name] as varbinary(100)) ordercol, Parent

    FROM ProductCategory
    WHERE Parent= '{00000000-0000-0000-0000-000000000000}'
    UNION ALL

    SELECT    ProductCategory.[Name], 
        ProductCategory.ID, 
        cast(ordercol + CAST(ProductCategory.[Name] AS BINARY(4)) as varbinary(100)) ordercol, 
        ProductCategory.Parent

    FROM ProductCategory INNER JOIN

    CTE ON ProductCategory.Parent =
    CTE.ID
)

SELECT [Name], ID, Parent
FROM CTE
ORDER BY ordercol, [Name]

Damit erhielt ich o.g. gewünschtes hierarchisch und alphabetisch korrekt sortiertes Resultat. Außerdem funktioniert jetzt sogar die Änderung von ORDER BY auf [Name] DESC.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET 2.0, SQL Server 2005, Sql Server 2005 Express, German, glengamoi.com, Javascript Posted by AlexanderZeitler on 5/11/2006 12:43 PM | Comments (0)

Gestern und heute haben sich bei glengamoi einige nützliche (Einsteiger-)Links angesammelt:

Einführung in Sql Server 2005 Stored Procedures

Beispiel zum Speichern von Daten in DB via SqlDataSource unter Vermeidung von SQL Injection

Infos zum ASP.NET 2.0 Page Life Cycle:

Common Steps in an ASP.NET Page's Life CycleApplication, Page and Control events in ASP.NET v2.0 ASP.NET 2.0 Page LifeCycle

Server.UrlEncode für Javascript: EncodeUri bzw. EncodeUriComponent

Umfangreiche Beschreibung der Volltext-Suche in Sql Server 2005 (+ Express Edition SP1)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: SQL Server 2005, Sql Server 2005 Express, SqlServer, German, Affairs Posted by AlexanderZeitler on 5/5/2006 5:39 AM | Comments (0)

SqlPrompt (aktuell noch Beta) ist ein Windows-Tool, das sich im Systray einnistet und von dort aus SQL-Intellisense für folgende Editoren bietet:

  • Query Analyzer (2000)
  • Enterprise Manager (2000)
  • Sql Server Management Studio (2005)
  • Visual Studio .NET 2003
  • Visual Studio 2005
  • Ultra Edit
  • EditPlus 2

SqlPrompt im Query Analyzer in Action:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: SQL Server 2005, German Posted by AlexanderZeitler on 4/25/2006 5:32 AM | Comments (0)

Die aktualisierte Version der SQL Server 2005 Dokumentation liegt zum Download (en/de) bereit.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: SQL Server 2005, Sql Server 2005 Express, German Posted by AlexanderZeitler on 4/19/2006 10:29 AM | Comments (0)

Bereits wenige Monate nach dem Erscheinen von SQL Server 2005 ist nun das Service Pack 1 zum Download verfügbar.

Um die Express Editions zu aktualisieren, müssen die aktualisierten Versionen mit SP1 heruntergeladen und installiert werden.

Hierbei gibt es jetzt außerdem zusätzlich zum Download mit normalem Funktionsumfang auch eine Version mit Reporting Services und Volltextsuche zum Download.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: .NET Framework 2.0, SQL Server 2005, VisualStudio 2005 Posted by AlexanderZeitler on 11/19/2005 12:18 PM | Comments (0)

If you've finished reading about the breaking changes in .NET Framework 2005, you may be interested in what's new in Visual Studio 2005 and SQL Server 2005.

So, here's the bunch of information on what's new:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: .NET Framework 2.0, SQL Server 2005, General Posted by AlexanderZeitler on 10/28/2005 8:46 AM | Comments (1)

Now it's time to develop some really cool applications ;-)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: .NET Framework 2.0, ASP.NET 2.0, SQL Server 2005 Posted by AlexanderZeitler on 10/27/2005 7:02 PM | Comments (0)

Get the hottest information on SQL Server 2005, Visual Studio 2005 and BizTalk Server 2006 straight from the product teams:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Datenbanken, SQL Server 2005, VisualStudio 2005 Posted by AlexanderZeitler on 10/27/2005 4:29 PM | Comments (0)

Visual Studio 2005 and SQL Server 2005 developer edition are available at MSDN Subscriber Downloads now. Pretty cool ;-)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: SQL Server 2005, Tools Posted by AlexanderZeitler on 10/14/2005 4:21 PM | Comments (12)

Today I tried to create a SQL Server 2005 Diagram using Microsoft Office Visio 2003. But when calling the Reverse Engineering command using the SQL Server / SQL Native Client for SQL Server 2005 I got the following error message:

After googling a for a while I read about a Visio 2005 for Enterprise Architects beta (when participating in the VS 2005 beta program), but I also read some posts that it expired already.

But I found another solution that works fine with Visio 2003:

Instead of using the SQL Server / SQL Native Client I'm using the Generic OLE DB Provider:

After clicking "Next", I'm selecting the SQL Native Client which I'm configuring as I used to do it before:

Then I click the "Next" button

After clicking "OK" I can select the desired database objects being displayed in the diagram - et voila:

Be the first to rate this post

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