Wednesday, February 28, 2007

Visual Studio Code Name "Orcas" - March 2007 Community Technology Preview (CTP) Available For Download

Get it here and start messing around with LINQ:

From the site:

Visual Studio code name “Orcas” delivers on Microsoft’s
vision of smart client applications by enabling developers to rapidly create
connected applications that deliver the highest quality rich user experiences.
This new version enables any size organization to rapidly create more secure,
manageable, and more reliable applications that take advantage of Windows Vista
and the 2007 Office System. By building these new types of applications,
organizations will find it easier than ever before to capture and analyze information
so that they can make effective business decisions.

This download is the March 2007 Community Technology Preview of Microsoft
Visual Studio Code-Named “Orcas”. This CTP is available in English only.

Note: This CTP is available as a Virtual
PC image
or as a self-extracting install. If you wish to use the Virtual PC
image you will need Virtual PC or Virtual Server to run this image. If you wish
to use the self extracting install, we advise that you do not install this on a
production machine. Depending on your hardware the download files make take
between 30-60 minutes to decompress.

This CTP targets early adopters of the Microsoft technology, platform, and
tools offerings. It enables developers to experience the upcoming toolset and
underlying platform improvements. We designed this release to enable developers
to try out new technology and product changes, but not to build production
systems. This limitation is fully covered in the EULA that accompanies this

The highlights of this CTP include:

  • LINQ

    The LINQ Project: this CTP represents a major milestone in the LINQ
    project. For more information about LINQ click here.
    • VB 9.0 Language
      Support: This CTP contains the following language features:
      • Query Expressions:
        Basic querying, filtering, and ordering support
      • Object Initializers
      • Extension Methods
      • Local Variable Type
      • Anonymous Types
      • XML literals
      • XML properties
      • New Line and
        Expression IntelliSense
    • C# 3.0 Language
      Support: This CTP implements all of the C#3.0 language features from the
      May LINQ CTP including:
      • Query Expressions
      • Object and Collection
      • Extension Methods
      • Local Variable Type
        Inference and Anonymous Types
      • Lambdas bound to
        Delegates and Expression trees
      • Complete design-time
        support: Intellisense, Formatting, Colorization
    • LINQ to ADO.NET
      • ADO.NET is fully
        integrated with LINQ and offers many options for using LINQ in various
        scenarios: LINQ to SQL provides direct access to database tables from
        the programming environment, LINQ to Entities enables developers to use
        LINQ over EDM models, and LINQ to DataSet allows the full expressivity
        of LINQ to be used over DataSets.
      • LINQ to Entities
        enables developers to program against a relational database using a view
        of the data that is appropriate for the application they are building,
        independent of the structure of the underlying database. The use of the
        Entity Data Model (EDM) enables developers to design models that follow
        the concepts built into the application, instead of having to map them
        to constructs available in relational stores. LINQ to Entities is built
        on the ADO.NET Provider model and will support working against different
        back end relational stores in addition to Microsoft SQL Server. This CTP
        includes a LINQ to Entities provider for SQL Server and SQL Server
        Compact Edition.
      • LINQ to SQL (previous
        name DLinq) has enhanced the functionality from the May 2006 LINQ CTP.
        You can find it in System.Data.Linq namespace in System.Data.Linq.dll.
        New in this release is that DataContext provides optimized modes for
        read-only use and serialization . Also new is that DataShape streamlines
        eager loading capabilities and adds the ability to set queries on
    • LINQ To SQL Designer
      • Methods can be created
        from stored procedures and functions within the designer.
      • Better handling of
        database schemas.
      • Improved inheritance
        support in the designer.
    • LINQ over XML (XLinq)
      • System.Xml Bridge
        Classes added – There is a set of extension methods allowing XPath /
        XSLT to be used over LINQ to XML trees, allow XSLT transformations to
        produce an LINQ to XML tree, and to validate an XElement tree against an
        XML Schema.
      • Event Model - This
        allows LINQ to XML trees to be efficiently synchronized with a GUI, e.g.
        a Windows Presentation Foundation application
      • Class hierarchy
        changes - XObject class added, XStreamingElement class (temporarily)
      • Various
        understandability / usability improvements – There have been a number of
        relatively minor changes done in response to internal reviews, usability
        studies, and external feedback to make the API more clean and
    • LINQ to Objects API
      • The LINQ to Objects
        API supports queries over any .NET collection, such as arrays and
        Generic Lists. This API is defined in the System.Linq namespaces inside

    • Extended, more powerful
      data APIs with the ADO.NET Entity Framework
      • With the ADO.NET
        Entity Framework developers will be able to model the view of the data
        that is appropriate for each one of the applications they are building,
        independently of the structure of the data in the underlying database.
        The use of the Entity Data Model (EDM) enables developers to design
        models that follow the concepts built into the application, instead of
        having to map them to constructs available in relational stores. Once
        the model is in place, the powerful ADO.NET Entity Framework API is used
        to access and manipulate the data as .NET classes or as rows and
        columns, whatever is appropriate for each application.
    • Added paging and stored
      procedures for update (“update customization”) for ADO.NET Entity
      • Paging: the paging
        support in the ADO.NET Entity Framework allows developers to “page” over
        data in a database by indicating the start row and number of rows to be
        included in the result. Paging is available through Entity SQL (using
        the LIMIT AND SKIP keywords) and through the query-builder methods in
        the ObjectQuery &ltT> class (Top and Skip). In a future CTP the
        feature will also be enabled to be used in LINQ queries by means of the
        standard Take and Skip LINQ operators.
      • Stored-procedures for
        update customization: the Entity Framework by default automatically
        generates SQL statements for insert, update and delete operations when
        processing changes to entities in memory to be sent to the database.
        With the stored-procedures update customization feature developers have
        the option to override the automatic SQL generation and instead provide
        stored-procedures that will perform the insert, update and delete
        operations, which the system will call during entity change processing.
        Among other things, this enables scenarios where direct access to tables
        is restricted in the database and the only way to make changes to the
        data is through stored-procedures.
    • Microsoft
      Synchronization Services for ADO.NET
      • Provides an
        application programming interface (API) to synchronize data between data
        services and a local store. The Synchronization Services API is modeled
        after the ADO.NET data access APIs and gives you an intuitive way to
        synchronize data. It makes building applications for occasionally
        connected environments a logical extension of building applications
        where you can depend on a consistent network connection. For details
        please visit

  • Web
    • Improvements for web
      development in this CTP include:
      • New ASP.NET WebForms
        design-surface with advanced XHTML and CSS features
      • JScript intellisense
        for ASP.NET AJAX and browser DOM
      • Multi-targetting for
        .NET Framework 2.0, 3.0, and 3.5 in websites and web applications
      • LINQ to SQL designer
        integration in websites and web applications

  • Client App-Level Services
    • Enable client
      application developers to use the same user profile and login services as
      your Web applications. This enables customers to utilize on set of
      backend storage for user personalization and authentication regardless of
      the applications type.

  • C# Workflow Rules
    • Workflow Rules allows
      users to enter rules (and conditions) in a code-like manner
      • Support the use of the
        new C# Extension methods features in their rules
      • Enable operator
        overloading and the new operators in their rules

  • XML
    • XML Tools: XSLT
      • Enables Input Data
        Breakpoints allowing the user to break the execution of the style-sheet
        whenever a certain node in input document is hit.
    • XML Editor Performance
      • Performance in the Xml
        Editor for Intellisense, schema validation etc is improved by
        implementing incremental parsing of the XML Document.
    • Seamless transition
      between XML Editor and XSD Designer
      • Improves the
        experience a user has when working with an XML Schema in textual and
        graphical mode at the same time.

  • MSBuild
    • Parallel/Multi-Processor
      • Building multiple
        projects in parallel, as much as possible based on the use of dependency
        information in projects to parallelize
      • Allowing the
        developer/builder to control the parallelism by providing them the
        ability to specify the number of processors to use for build.

  • UAC Manifests in the Managed Build Process
    • Support for manifests
      that are embedded into the final executable via the Build process.

  • IDE
    • Windows Presentation
      Foundation (WPF) Designer (“Cider”) & Application Tools to deliver
      the ability to:
      • Create, edit, build,
        run and debug WPF projects
      • Use the WPF Designer
        • Preview any XAML in
          the designer including user defined controls and types
        • Design Windows, Pages
          and UserControls
        • Do basic layout tasks
          in a Grid
        • Do basic property
          editing using the new property browser
        • Easily understand and
          navigate “document structure” using the Document Outli
        • See changes in the
          designer immediately in the XAML
      • Use the XAML Editor
        • Edit XAML with
        • See changes in the
          XAML immediately in the designer
        • Build design time for
          WPF controls
    • UAC manifests in the
      IDE for Windows Vista applications
      • Enable developers on
        Windows Vista to easily include the UAC manifest as an embedded

  • CLR
    • Add IRI support (RFC
      3987) to URI related classes
      • This allows resource
        identifiers to be specified using a character set that supports all
    • New Async model on
      Socket class
      • A new Async model is
        reduces the per I/O overhead compared to the current I/O model
    • Peer Networking Classes
      • Delivers a set of
        peer-to-peer network APIs that allow a developer to easily extend an
        application with compelling collaboration functionality.
    • WMI.NET Provider
      Extension 2.0
      • WMI.NET Provider
        Extension 2.0 simplifies and enhances the development of WMI providers
        in the .Net framework to enable the management of the .NET applications
        while minimizing the impact on the development time.
        • Delivers equivalent
          access to WMI features and functions available to native code
        • Exposes property
          updates and methods to managed code.
        • Improved scalability
          for large collections of WMI entities.

  • Office
    • Enable ClickOnce deployment
      for Microsoft Office applications
    • Developers now have an
      easy to use and version resilient security model for their applications
      that will exist for future versions of Visual Studio and Office. With
      full support for ClickOnce deployment of all Office 2007 customizations
      and applications, developers and administrators now have the right tools
      and framework for easy deployment and maintenance of their Office

  • Team Architect
    • Top-down service design
      • Top-down system design
        allows an application architect/lead developer to perform the design of
        a business solution without having to be confronted with technology
        decisions. It enables the user to progressively refine a high-level
        system design, designing new sub-systems and applications in the context
        of the system in which they are to be used.
    • Architectural Roles on
      System, Applications and Endpoints
      • Enables an architect,
        while working on the high-level design of a system’s architecture using
        the System Designer, to introduce elements into the design that play a
        specific pre-defined architectural role(s) within architectural

  • Team Developer
    • Profiler Support for
      WCF Applications
      • Enable profiling of
        WCF based applications to improve application performance
    • Customize and extend
      code correctness policies
      • Code Analysis Check-in
        Policy improvements to communicate to a developer why the check-in
        policy failed and to provide guidance on how to pass the policy
    • Customize and extend
      code correctness policies
      • Code Analysis Check-in
        Policy improvements to communicate to a developer why the check-in
        policy failed and to provide guidance on how to pass the policy
    • Performance tune an
      enterprise application
      • Enables developers to
        run profiling during load and test procedures for a system, to see how
        it behaves, and use integrated tools to profile, debug and tune. This
        also enables performance base-lining, so that users can save a baseline
        profile and then, if the performance degrades, compare up-to-date traces
        to identify the source of the regression

  • Team Test
    • Unit Test Generation
      • Improvements to unit
        test generation provide an easy way for the user to specify what methods
        to test, and generate test methods and helper code to do unit testing,
        as well as providing unit test support for generics.
    • Web Test Validation
      Rule Improvements
      • Web Test rules
        improvements enable testers to create more comprehensive validation
        rules for the application being tested. These improvements include the
        following functions:
        • Stop test on error
        • Search request and
        • Add validation rule
          for title
        • Redirect validation
        • Provide test level
          validation rules
        • Expected HTTP code
        • Warning level for
          errors on dependents
    • Better Web Test Data
      • This feature allows
        users to data bind .CSV and XML files, as well as databases to a web
        test, using a simple databinding wizard.
    • Improved Load Test
      Results Management
      • With this feature user
        can open or remove an existing load test result from the load test
        repository. User can also import and export load test results files.

  • Team Foundation Server
    • Team Build
      • Support multi-threaded
        builds with the new MSBuild.
      • Continuous Integration
        – There are many components to this, including build queuing and queue management,
        drop management (so that users can set policies for when builds should
        be automatically deleted), and build triggers that allows configuration
        of exactly how when CI builds should be triggered, for example – every
        checkin, rolling build (completion of one build starts the next), etc.
      • Improved ability to
        specify what source, versions of source, etc to include in a build.
      • Improved ability to
        manage multiple build machines.
      • Simplified ability to
        specify what tests get run as part of a build
    • Version Control support
      • Destroy- The version
        control destroy operation provides administrators with the ability to
        remove files and folders from the version control system. The destroyed
        files and folders cannot be recovered once they are destroyed. Destroy
        allows administrators to achieve SQL server disk space usage goals
        without constantly needing to add more disks to the data tier machine.
        Destroy also facilitates removing versioned file contents that must be
        permanently removed from the system for any other reason.
      • Annotate - Annotate is
        a feature that allows developers to inspect a source code file and see
        at line-by-line level of detail who last changed each section of code.
        It brings together changeset data with difference technology to enable
        developers to quickly learn change history inside a source file.
      • Folder Diff - Team
        Foundation Server now supports compare operations on folders, whereby
        the contents of the folder are recursively compared to identify files
        that differ. Folder diff can compare local folders to local folders,
        local folders to server folders, and server folders to server folders.
        It’s a great way of identifying differences between branches, files that
        you’ve changed locally, and files that have changed between two points
        in time.
      • Get Latest on Checkout
        - As an optional setting on a team project or on an individual basis,
        you can have Team Foundation Server always download the latest version
        of a file when you check it out. This helps ensure that you don’t have
        to merge your changes with somebody else’s when you check the file back
    • Performance and Scale
      • This release includes
        numerous improvements in performance and scalability of Team Foundation

  • Visual C++
    • Easily add the Windows
      Vista “Look and Feel” to native C++ applications
      • Developers can use
        Visual Studio to build ISV applications that exhibit the Windows Vista
        “look & feel”. A number of the Windows Vista “look & feel”
        features are available simply by recompiling an MFC application. Deeper
        integration that requires more coding or design work on the part of the
        developer is also simplified with Visual Studio’s integrated support for
        the Windows Vista native APIs.

Existing CTPs: As Visual Studio code name “Orcas” CTPs are released on a predefined cadence, existing CTPs (such as the LINQ May 2006 CTP) may not yet have been integrated into a given “Orcas” CTP release (This should not be taken as a change in commitment to any existing technology that has been made available as a CTP but instead is just a real world example of how large applications, with many technology areas, are built. We will be integrating this existing functionality into future CTP builds.

Developers using a VPC image can run the CTP on a machine without impacting any existing software installations. The CTP can be removed by deleting the folder and using the Virtual PC application to remove the configuration information.

This image ships with networking set to “local”. This setting enables the virtual machine to think it is connected to a network without actually connecting and exposing the machine to the Internet. We recommend that customers do not modify the networking settings. Customers who wish to turn networking “on” to connect the image to a physical network are advised that they will need to ensure the security of the virtual machine as well as apply any security updates that may have become available since the release of this image.

Using ALTER INDEX…REBUILD To Rebuild A Clustered Index Does Not Rebuild Its Nonclustered Indexes By Default On SQL Server 2005

How many times have you asked/been asked the following question: Does rebuilding a clustered index rebuild nonclustered indexes?

Well Ken Henderson has the answer for you on his blog.

On SQL Server 2005, using ALTER INDEX…REBUILD to rebuild a clustered index
does not rebuild its nonclustered indexes by default

Read the rest here:

Sunday, February 25, 2007

Failure Trends in a Large Disk Drive Population

The Google engineers published a paper on Failure Trends in a Large Disk Drive Population. Based on a study of 100,000 disk drives over 5 years they found some interesting stuff:

While drive manufacturers often quote yearly failure rates below 2%,
user studies have seen rates as high as 6%.

We find, for example, that after their first scan error, drives are 39
times more likely to fail within 60 days than drives with no such errors. First
errors in reallocations,offline reallocations, and probational counts are also
strongly correlated to higher failure probabilities.

Six percent, that is higher than I expected. I must say (and I am knocking on wood as I write this) that I only saw a drive die once (within a month of deploying) on a blade server. The only major problem I had was when consulting for a client in NYC. They had a SQL Server box which was running for 2 years without a problem. We upgraded the machine to an active/passive cluster and a week later the motherboard died (downtime 20 seconds ;-) ), talking about good timing.....

So what failure rates do you see? Does stuff break down a lot?

Saturday, February 24, 2007

Friday, February 23, 2007

Math Geniuses?

What do you think? Can you answer these very difficult questions?

Thursday, February 22, 2007

How To Find Out Which Columns Have Defaults And What Those Default Values Are

Okay so many many moons ago you created a bunch of tables and those tables have columns of course. You want to know how to find the columns that have defaults.
There are a couple of ways to do this
Below is a list:

1 INFORMATION_SCHEMA.COLUMNS view (2000 and 2005)
2 sysobjects,syscolumns and syscomments (2000 only)
3 sys.default_constraints and sys.sysobjects (2005 only)
4 sp_help (2000 only)

So let's get started with some code


* FROM blah

--SQL 2000/2005

--SQL 2000
FROM sysobjects o
INNER JOIN syscolumns c
ON o.parent_obj =
AND = c.colid
INNER JOIN syscomments s
ON =
WHERE o.xtype = 'D'
AND OBJECT_NAME(parent_obj) = 'blah'

--SQL 2005
sys.default_constraints d
JOIN sys.sysobjects o ON d.parent_object_id =
WHERE = 'blah'

See what happens when you don't specify a name (we will do this later)? You will get wacky names like these: DF__blah__id__15A53433 and DF__blah__SomeDate__1699586C
Instead of specifying the default when creating the table use an alter table add constraint statement.Let's see this in action.





* FROM blah

--SQL 2000/2005

--SQL 2000
FROM sysobjects o
INNER JOIN syscolumns c
ON o.parent_obj =
AND = c.colid
INNER JOIN syscomments s
ON =
WHERE o.xtype = 'D'
AND OBJECT_NAME(parent_obj) = 'blah'

--SQL 2005
sys.default_constraints d
JOIN sys.sysobjects o ON d.parent_object_id =
WHERE = 'blah'

And last we have sp_help
You can use sp_help in SQL Server 2000(you can also use it in SQL server 2005 but it doesn't return the defaults )
Execute the following
sp_help 'blah'

The defaults will be in the last resultset (the one where the first column name = constraint_type)

And last but not least did you notice that we had CURRENT_TIMESTAMP but when we queried the table we saw GETDATE() This is kind of strange since CURRENT_TIMESTAMP is ANSI complaint but GETDATE() is not

Wednesday, February 21, 2007

SQL Server 2005 Best Practices Analyzer (February 2007 CTP) Available For Download

As if you did not download enough in the last 3 days here is one more: SQL Server 2005 Best Practices Analyzer (February 2007 CTP)

The SQL Server 2005 Best Practices Analyzer (BPA) gathers data from Microsoft Windows and SQL Server configuration settings. BPA uses a predefined list of SQL Server 2005 recommendations and best practices to determine if there are potential issues in the database environment.

This download is the February 2007 Community Technology Preview of SQL Server 2005 Best Practices Analyzer.

SQL Server 2005 Books Online Is Not Part Of The Service Pack 2 Download

If you have downloaded SQL Server 2005 Service Pack 2 you probably have noticed that it does not come with Books On Line. You can download that here: SQL 2005 Books Online Feb 2007 (SP2)

Here are two more downloads:
SQL Server 2005 Reporting Services Add-in for SharePoint Technologies
SQL Server 2005 Data Mining Add-ins for Microsoft Office 2007

Tuesday, February 20, 2007

February 2007 Feature Pack for Microsoft SQL Server 2005

Yesterday I told you that SQL server Service Pack 2 has been released. Microsoft also released the February 2007 Feature Pack for Microsoft SQL Server 2005

The February 2007 Feature Pack for Microsoft SQL Server 2005 is a collection of standalone install packages that provide additional value for SQL Server 2005.

Here is what is available:

Microsoft ADOMD.NET
ADOMD.NET is a Microsoft .NET Framework object model that enables software developers to create client-side applications that browse metadata and query data stored in Microsoft SQL Server 2005 Analysis Services. ADOMD.NET is a Microsoft ADO.NET provider with enhancements for online analytical processing (OLAP) and data mining.

Microsoft Core XML Services (MSXML) 6.0
Microsoft Core XML Services (MSXML) 6.0 is the latest version of the native XML processing stack. MSXML 6.0 provides standards-conformant implementations of XML 1.0, XML Schema (XSD) 1.0, XPath 1.0, and XSLT 1.0. In addition, it offers 64-bit support, increased security for working with untrusted XML data, and improved reliability over previous versions of MSXML.

Microsoft OLEDB Provider for DB2
The Microsoft OLE DB Provider for DB2 is a COM component for integrating vital data stored in IBM DB2 databases with new solutions based on Microsoft SQL Server 2005 Enterprise Edition and Developer Edition. SQL Server developers and administrators can use the provider with Integration Services, Analysis Services, Replication, Reporting Services, and Distributed Query Processor. Run the self-extracting download package to create an installation folder. The single setup program will install the provider and tools on x86, x64, and IA64 computers. The package includes product updates in the form of an integrated Service Pack 1. Read the installation guide and Readme for more information.

Microsoft SQL Server Management Pack for MOM 2005
The Microsoft SQL Server Management Pack enables you to monitor SQL Server 2005 and SQL Server 2000 in an enterprise environment. Included are enterprise-level capabilities to monitor resource availability and configuration, collect performance data, and test default thresholds. Local and remote connectivity checks help ensure database availability.
With the embedded expertise in the SQL Server Management Pack, you can identify issues and manage issues before they become critical. This Management Pack increases the security, availability, and performance of your SQL Server infrastructure.
The Microsoft SQL Server Management Pack Guide that is included describes the content of the management pack and how to deploy it.

Microsoft SQL Server 2000 PivotTable Services
PivotTable Services 8.0 is the OLE DB provider for SQL Server 2000 Analysis Services and is used to connect with an Analysis Services 2000 server. PivotTable Services does not work with SQL Server 2005 Analysis Services. Therefore, client applications that need connect to Analysis Services in both SQL Server 2000 and SQL Sever 2005 will need to install both PivotTable Services 8.0 and Analysis Services 9.0 OLE DB Provider in a side-by-side configuration.

Microsoft SQL Server 2000 DTS Designer Components
The Microsoft SQL Server 2000 Data Transformation Services (DTS) package designer is a design tool used by developers and administrators of SQL Server 2005 servers to edit and maintain existing DTS packages until they can be upgraded or recreated in the SQL Server 2005 Integration Services package format. After installing this download, SQL Server 2005 users can continue to edit and maintain existing DTS packages from the Object Explorer in SQL Server 2005 Management Studio and from the Execute DTS 2000 Package Task Editor in Business Intelligence Development Studio, without needing to reinstall the SQL Server 2000 tools. The DTS package designer in this download was formerly accessed from the Data Transformation Services node in SQL Server 2000 Enterprise Manager.

Microsoft SQL Server Native Client
Microsoft SQL Server Native Client (SQL Native Client) is a single dynamic-link library (DLL) containing both the SQL OLE DB provider and SQL ODBC driver. It contains run-time support for applications using native-code APIs (ODBC, OLE DB and ADO) to connect to Microsoft SQL Server 7.0, 2000 or 2005. SQL Native Client should be used to create new applications or enhance existing applications that need to take advantage of new SQL Server 2005 features. This redistributable installer for SQL Native Client installs the client components needed during run time to take advantage of new SQL Server 2005 features, and optionally installs the header files needed to develop an application that uses the SQL Native Client API.

Microsoft SQL Server 2005 Analysis Services 9.0 OLE DB Provider
The Analysis Services 9.0 OLE DB Provider is a COM component that software developers can use to create client-side applications that browse metadata and query data stored in Microsoft SQL Server 2005 Analysis Services. This provider implements both the OLE DB specification and the specification’s extensions for online analytical processing (OLAP) and data mining.

Microsoft SQL Server 2005 Backward Compatibility Components
The SQL Server Backward Compatibility package includes the latest versions of Data Transformation Services 2000 runtime (DTS), SQL Distributed Management Objects (SQL-DMO), Decision Support Objects (DSO), and SQL Virtual Device Interface (SQLVDI). These versions have been updated for compatibility with SQL Server 2005 and include all fixes shipped through SQL Server 2000 SP4.

Microsoft SQL Server 2005 Command Line Query Utility
The SQLCMD utility allows users to connect, send Transact-SQL batches, and output rowset information from SQL Server 7.0, SQL Server 2000, and SQL Server 2005 instances. SQLCMD is a replacement for ISQL and OSQL, but can coexist with installations that have ISQL or OSQL installed.

Microsoft SQL Server 2005 Datamining Viewer Controls
The Data Mining Web Controls Library is a set of Microsoft Windows Forms controls that enable software developers to display data mining models created using Microsoft SQL Server 2005 Analysis Services in their client-side applications. The controls in this library display the patterns that are contained in Analysis Services mining models.

Microsoft SQL Server 2005 JDBC Driver
In its continued commitment to interoperability, Microsoft has released and supports a new Java Database Connectivity (JDBC) driver for SQL Server 2005. The SQL Server 2005 JDBC Driver download is available to all SQL Server users at no additional charge and provides access to SQL Server 2000 and SQL Server 2005 from any Java application, application server, or Java-enabled applet. This is a Type 4 JDBC driver that provides database connectivity through the standard JDBC application programming interfaces (APIs) available in J2EE (Java2 Enterprise Edition).

Microsoft SQL Server 2005 Management Objects Collection
The Management Objects Collection package includes several key elements of the SQL Server 2005 management API, including Analysis Management Objects (AMO), Replication Management Objects (RMO), and SQL Server Management Objects (SMO). Developers and DBAs can use these components to programmatically manage SQL Server 2005.

Microsoft SQL Server 2005 Compact Edition
Microsoft SQL Server 2005 Compact Edition is the next version of SQL Server Mobile adding the desktop platform. SQL Server Compact extends the SQL Server Mobile technology by offering a low maintenance, compact embedded database for single-user client applications for all Windows platforms including tablet PCs, pocket PCs, smart phones and desktops. Just as with SQL Server Mobile, SQL Server Compact is a free, easy-to-use, lightweight, and embeddable version of SQL Server 2005 for developing desktop and mobile applications.

Microsoft SQL Server 2005 Notification Services Client Components
The SQL Server 2005 Notification Services Client Components package provides client APIs that enable subscription management and event submission within custom applications that include SQL Server 2005 Notification Services functionality. The subscription management APIs allow developers to create subscriptions and subscribers, and manage subscriber devices. The event submission APIs allow users to specify events using the event APIs or stored procedures.

Microsoft SQL Server 2005 Upgrade Advisor
Upgrade Advisor analyzes instances of SQL Server 7.0 and SQL Server 2000 in preparation for upgrading to SQL Server 2005. Upgrade Advisor identifies deprecated features and configuration changes that might affect your upgrade, and it provides links to documentation that describes each identified issue and how to resolve it.

Microsoft .NET Data Provider for mySAP Business Suite, Preview Version
SQL Server 2005 includes support for accessing SAP data by using the Microsoft .NET Data Provider for mySAP Business Suite. This provider lets you create an Integration Services package that can connect to a mySAP Business Suite solution and then execute commands to access data via supported interfaces. You can also create Reporting Services reports against a server running the mySAP Business Suite.
You can use the Microsoft .NET Data Provider for mySAP Business Suite in the SQL Server Import and Export Wizard and in various Integration Services features (including the Script task, the DataReader Source component, and the Script component), as well as the data processing extensions in Reporting Services.
The Microsoft .NET Data Provider for mySAP Business Suite is not included in SQL Server 2005. The preview version is licensed as pre-release software as outlined in the License Terms. See the Readme included with the download for information on the prerequisites for using the Microsoft .NET Data Provider for mySAP Business Suite.

Reporting Add-In for Microsoft Visual Web Developer 2005 Express
The Reporting Add-In for Microsoft Visual Web Developer 2005 Express includes a ReportViewer control, an integrated report designer, and a comprehensive API that lets you customize run-time functionality. You can use the control to add interactive real-time data reports to your ASP.NET Web applications. Reports can use data from any ADO.NET DataTable or custom Business object. You can create reports that combine tabular, matrix, and visual data in free-form or traditional report layouts. An integrated report designer is included so that you can create the custom reports that bind to the control.
The Reporting Add-In is the same reporting component that is included with other editions of Visual Studio, but without support for Windows Forms applications. For more information including product documentation and samples, see the ReportViewer Controls (Visual Studio) topic on MSDN.

Microsoft Exception Message Box
The exception message box is a programmatic interface that you can use in your applications for any tasks for which MessageBox may be used. The exception message box is a supported managed assembly designed to elegantly handle managed code exceptions. It provides significantly more control over the messaging experience and gives your users the options to save error message content for later reference and to get help on messages.

Data Mining Managed Plug-in Algorithm API for SQL Server 2005
The Managed Plug-in API is a Microsoft .NET object model that enables software developers to create plug-in data mining algorithms for SQL Server 2005 by using CLI-compliant languages, such as Visual C# 2.0. The object model is available as source code and it needs to be built on the developer’s computer. The package includes a step-by-step tutorial, a compiled HTML help file (.chm), as well as a sample plug-in algorithm developed in C#.

Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies
Microsoft SQL Server 2005 Reporting Services Add-in for SharePoint Technologies allows you to take advantage of SQL Server 2005 Service Pack 2 (SP2) report processing and management capabilities in SharePoint. The download provides a Report Viewer web part, web application pages, and support for using standard Windows SharePoint Services.

Microsoft SQL Server 2005 Data Mining Add-ins for Microsoft Office 2007
Microsoft SQL Server 2005 Data Mining Add-ins for Microsoft Office 2007 allow you take advantage of SQL Server 2005 predictive analytics in Office Excel 2007 and Office Visio 2007. The download includes Table Analysis Tools for Excel, Data Mining Client for Excel, and Data Mining Templates for Visio.

You can download all the packages here:

Podcast With Dr. Peter Chen on the Entity Relationship Model and ADO.NET Entity Framework On Channel 9

If you are a SQL developer then you have probably heard of Dr. Peter Chen, he is the person who wrote the original paper on Entity-Relationship model (ER model).

From the site:
Dr. Peter Chen is a Fellow of ACM, IEEE, and AAAS and has received many prestigious awards including ACM/AAAI Allen Newell Award and IEEE Harry Goode Award. He has been listed in Who’s Who in America and Who’s Who in the World for more than 15 years.

Dr. Chen's original paper on the
Entity-Relationship model (ER model)
, published in 1976 is one of
the most cited papers in the computer software field. Based on one particular
citation database, Chen's paper is the
35th most cited
article in Computer Science.
It is the 4th most downloaded
paper from the ACM Digital Library in January 2005 (Communications of ACM, March
2005) even though the paper was published 30 years ago.

Dr. Chen’s work is a cornerstone of software engineering, in particular Computer-Aided Software Engineering (CASE). In the late 80’s and early 90’s, IBM’s Application Development Cycle (AD/Cycle) framework and DB2 repository (RM/MVS) were based on the ER model. Other vendors’ repository systems such as Digital’s CDD+ were also based on the ER model. Prof. Chen has made significant impact on the CASE industry by his research work and by his lecturing around the world on structured system development methodologies. Most of the major CASE tools including Computer Associates’ ERWIN, Oracle’s Designer/2000, and Sybase’s PowerDesigner (and even a general drawing tool like Microsoft’s VISIO) are influenced by the ER model.

In this podcast, Brian Beckman interviews Dr. Chen along with Jose Blakeley, Software Architect, SQL Server, and Britt Johnston, Director of Program Management, Data Programmability

The podcast is 51 minutes and 24 seconds

Visit Channel 9 to download the Podcast

Monday, February 19, 2007

Microsoft Releases SQL Server 2005 Service Pack 2

Microsoft Corp. today released Microsoft® SQL Server™ 2005 SP2, an update to its award-winning data management and analysis platform. Customers can now take advantage of enhancements in the familiar and easy-to-use Windows Vista™ operating system and 2007 Microsoft Office system to easily connect and integrate with the power, security and reliability of SQL Server 2005. In addition, Microsoft announced that it is expanding virtualization use rights to allow unlimited virtual instances on servers that are fully licensed for SQL Server 2005 Enterprise Edition. For customers who want maximum flexibility in their use of virtualization technology, now or in the future, SQL Server 2005 Enterprise Edition is the ideal choice.

“SP2 delivers customer-driven improvements and new features that align with our data platform vision,” said Ted Kummert, corporate vice president of the Data and Storage Platform Division at Microsoft. “SP2 realizes a step forward in enabling organizations to bring the business intelligence capabilities of SQL Server 2005 directly to end users in the tools they use every day.”

Key enhancements to SQL Server SP2 include the following:

Data Mining Add-ins for the 2007 Microsoft Office system enable data mining functionality from SQL Server Analysis Services (SSAS) to be used directly within Excel® 2007 and Visio® 2007.

SQL Server Reporting Services (SSRS) compatibility with Microsoft Office SharePoint® Server 2007 provides integration with the Report Center in SharePoint, enabling the seamless consumption and management of SSRS reports within SharePoint.

SQL Server Analysis Services improvements for Excel 2007 and Excel Services relate to performance and functionality.

Data compression (varDecimal) is an important feature for data warehousing scenarios, requiring less disk storage of decimal data and increasing overall performance.

Manageability enhancements, based on customer feedback, provide management capabilities for database administrators such as improvements in database maintenance plans, enhanced management reports and a new copy database wizard.

Management reports added to SQL Server Express Edition enable customers to get insights into the performance of their Express Edition and SQL Server Compact Edition databases.

Interoperability improvements including Oracle support in the Report Builder feature enable customers to use its functionality on top of Oracle data sources. Customers also have access to SQL Server Reporting Services to build reports on top of Hyperion’s Essbase cubes.

Customers can download SQL Server 2005 Service Pack 2 immediately from

Sunday, February 18, 2007

Chuck Boyce Has Some Joe Celko Videos On YouTube

Chuck Boyce left me a comment on the Celko post yesterday. I decided to make it a separate post since most people who use a RSS reader don't see the comments

Here are some videos of Adam Machanic interviewing Joe Celko at the 2006 PASS Summit
that I just published today to our new
Solid Quality Learning YouTube channel

Joe Celko on the evil of cursors

Joe Celko discusses the problem with the median puzzle

Joe Celko recalls an old-school pre CASE statement trick

Thanks Chuck

Link to Chuck's post:

Man sues IBM over firing, says he's an Internet addict

I won't comment on the Britney madness but here is another gem:

A man who was fired by IBM for visiting an adult chat room at work is suing the company for $5 million, claiming he is an Internet addict who deserves treatment and sympathy rather than dismissal.

James Pacenza, 58, of Montgomery, says he visits chat rooms to treat traumatic stress incurred in 1969 when he saw his best friend killed during an Army patrol in Vietnam.

In papers filed in federal court in White Plains, Pacenza said the stress caused him to become "a sex addict, and with the development of the Internet, an Internet addict." He claimed protection under the American with Disabilities Act.

Right, what's next? I know, I will sue my neighbour because his house is bigger and now I am suffering from Napoleon syndrome because of that.

Here is the link to the CNN story:

Clerks II: Starwars vs Lord of the Ring Clip On YouTube

All right look, there's only one return, okay, and it ain't "of the King," it's "of the Jedi."

I own the extended version of the LOTR trilogy and also all the Star Wars movies. To me this is a useless debate since the LOTR trilogy is much better than the original Star Wars trilogy (Episodes 4-6). The YouTube clip is rated R so don’t say I didn’t warn you. And make sure you read the comments

Here are two of them

...Depth and coherence of a cartoon? At least Mr. Lucas has signed off on allowing people to expand the Star Wars universe. Millions of inhabited planets. Thousands of sentient beings. LIGHTSABERS. How's a ring gonna stop a blade of coherent light through the chest?

Aww...made the LOTR fans a little angry did we? So sorry we made your precious move feel inferior, but they were honestly drawn out way longer then they should have been and, wow, Star Wars was in NO WAY based off LOTR, that's just a silly assumption...stop complaining about it, it's not it matters to anyone, honestly.

Here is the link to the precioussss clip

Saturday, February 17, 2007

Podcast With SQL Maven Joe Celko

I have been waiting for sooooo long for this, I just want to hear these words by Celko himself "Rows are not records; fields are not columns; tables are not files."

You can get the podcast here, it is show number 21 and in this show Celko discusses SQL coding and multiprocessing futures

For those of you who don't know who Joe Celko is, here is a small list
Celko always answers very polite in newsgroups (yeah right)
Celko is the author of SQL for Smarties
Celko coined the term Lasagna Code
And last but not least Celko has participated on the ANSI X3H2 Database Standards Committee, and helped write the SQL-89 and SQL-92 standards

Wednesday, February 14, 2007

How Is SQL Server Books On Line Created?

Buck Woody one of the Technical Writers in the SQL Product Group has started a blog about documentation. His first post SQL Server Books Online explains how Books On Line is created. Did you know that Books Online has over 58,000 pages of content?

The Sysinternals Troubleshooting Utilities have been rolled up into a single Suite of tools

Mark Russinovich the guy who revealed to the world that Sony CDs had that nasty rootkit installed has made available a single suite of tools for download. These tools are a must have for every single windows developer.

The Sysinternals Troubleshooting Utilities have been rolled up into a single Suite of tools. This file contains the individual troubleshooting tools and help files. It does not contain non-troubleshooting tools like the BSOD Screen Saver or NotMyFault.

Download it here

Here is what is included:

• AccessChk

v2.0 (11/1/2006)
This tool shows you the accesses the user or group you specify has to files, Registry keys or Windows services.

• AccessEnum

v1.32 (11/1/2006)
This simple yet powerful security tool shows you who has what access to directories, files and Registry keys on your systems. Use it to find holes in your permissions.

• AdRestore

v1.1 (11/1/2006)
Undelete Server 2003 Active Directory objects

• Autologon

v2.10 (11/1/2006)
Bypass password screen during logon.

• Autoruns

v8.61 (1/22/2007)
See what programs are configured to startup automatically when your system boots and you login. Autoruns also shows you the full list of Registry and file locations where applications can configure auto-start settings.

• BgInfo

v4.0 (11/1/2006)
This fully-configurable program automatically generates desktop backgrounds that include important information about the system including IP addresses, computer name, network adapters, and more.

• BlueScreen

v3.2 (11/1/2006)
This screen saver not only accurately simulates Blue Screens, but simulated reboots as well (complete with CHKDSK), and works on Windows NT 4, Windows 2000, Windows XP, Server 2003 and Windows 9x.

BlueScreen is NOT part of the suite, you can download it here

• CacheSet

v1.0 (11/1/2006)
CacheSet is a program that allows you to control the Cache Manager's working set size using functions provided by NT. It's compatible with all versions of NT and full source code is provided.

• ClockRes

v1.0 (11/1/2006)
View the resolution of the system clock, which is also the maximum timer resolution

• Contig

v1.53 (11/1/2006)
Wish you could quickly defragment your frequently used files? Use Contig to optimize individual files, or to create new files that are contiguous.

• Ctrl2cap

v2.0 (11/1/2006)
This is a kernel-mode driver that demonstrates keyboard input filtering just above the keyboard class driver in order to turn caps-locks into control keys. Filtering at this level allows conversion and hiding of keys before NT even "sees" them. Full source is included. Ctrl2cap also shows how to use NtDisplayString() to print messages to the initialization blue-screen.

• DebugView

v4.64 (1/8/2007)
Another first from Sysinternals: This program intercepts calls made to DbgPrint by device drivers and OutputDebugString made by Win32 programs. It allows for viewing and recording of debug session output on your local machine or across the Internet without an active debugger.

• DiskExt

v1.0 (11/1/2006)
Display volume disk-mappings

• DiskView

v2.21 (11/1/2006)
Graphical disk sector utility

• Diskmon

v2.01 (11/1/2006)
This utility captures all hard disk activity or acts like a software disk activity light in your system tray.

• Du

v1.31 (11/1/2006)
View disk usage by directory

• EFSDump

v1.02 (11/1/2006)
View information for encrypted files

• Filemon

v7.04 (11/1/2006)
This monitoring tool lets you see all file system activity in real-time.

• Handle

v3.20 (11/1/2006)
This handy command-line utility will show you what files are open by which processes, and much more.

• Hex2dec

v1.0 (11/1/2006)
Convert hex numbers to decimal and vice versa.

• Junction

v1.04 (11/1/2006)
Create Win2K NTFS symbolic links

• LDMDump

v1.02 (11/1/2006)
Dump the contents of the Logical Disk Manager's on-disk database, which describes the partitioning of Windows 2000 Dynamic disks.

• ListDLLs

v2.25 (11/1/2006)
List all the DLLs that are currently loaded, including where they are loaded and their version numbers. Version 2.0 prints the full path names of loaded modules.

• LiveKd

v3.0 (11/1/2006)
Use Microsoft kernel debuggers to examine a live system.

• LoadOrder

v1.0 (11/1/2006)
See the order in which devices are loaded on your WinNT/2K system

• MoveFile

v1.0 (11/1/2006)
Allows you to schedule move and delete commands for the next reboot.

• LogonSessions

v1.1 (11/1/2006)
List the active logon sessions on a system.

• NewSID

v4.10 (11/1/2006)
Learn about the computer SID problem everybody has been talking about and get a free computer SID changer, NewSID, complete with full source code.

• NTFSInfo

v1.0 (11/1/2006)
Use NTFSInfo to see detailed information about NTFS volumes, including the size and location of the Master File Table (MFT) and MFT-zone, as well as the sizes of the NTFS meta-data files.

• PageDefrag

v2.32 (11/1/2006)
Defragment your paging files and Registry hives!

• PendMoves

v1.1 (11/1/2006)
Enumerate the list of file rename and delete commands that will be executed the next boot

• Portmon

v3.02 (11/1/2006)
Monitor serial and parallel port activity with this advanced monitoring tool. It knows about all standard serial and parallel IOCTLs and even shows you a portion of the data being sent and received. Version 3.x has powerful new UI enhancements and advanced filtering capabilities.

• Process Explorer

v10.21 (11/1/2006)
Find out what files, registry keys and other objects processes have open, which DLLs they have loaded, and more. This uniquely powerful utility will even show you who owns each process.

• Process Monitor

v1.01 (11/9/2006)
Monitor file system, Registry, process, thread and DLL activity in real-time.

• ProcFeatures

v1.10 (11/1/2006)
This applet reports processor and Windows support for Physical Address Extensions and No Execute buffer overflow protection.

• PsExec

v1.80 (2/12/2007)
Execute processes with limited-user rights.

• PsFile

v1.02 (12/4/2006)
See what files are opened remotely.

• PsGetSid

v1.43 (12/4/2006)
Displays the SID of a computer or a user.

• PsInfo

v1.74 (12/4/2006)
Obtain information about a system.

• PsKill

v1.12 (12/4/2006)
Terminate local or remote processes.

• PsList

v1.28 (12/4/2006)
Show information about processes and threads.

• PsLoggedOn

v1.33 (12/4/2006)
Show users logged on to a system

• PsLogList

v2.64 (12/4/2006)
Dump event log records.

• PsPasswd

v1.22 (12/4/2006)
Changes account passwords.

• PsService

v2.21 (12/4/2006)
View and control services.

• PsShutdown

v2.52 (12/4/2006)
Shuts down and optionally reboots a computer.

• PsSuspend

v1.06 (12/4/2006)
Suspend and resume processes.

• PsTools

v2.43 (2/12/2007)
The PsTools suite includes command-line utilities for listing the processes running on local or remote computers, running processes remotely, rebooting computers, dumping event logs, and more.

• RegDelNull

v1.10 (11/1/2006)
Scan for and delete Registry keys that contain embedded null-characters that are otherwise undeleteable by standard Registry-editing tools.

• RegHide

v1.0 (11/1/2006)
Creates a key called "HKEY_LOCAL_MACHINE\Software\Sysinternals\Can't touch me!\0" using the Native API, and inside this key it creates a value.

• Regjump

v1.01 (11/1/2006)
Jump to the registry path you specify in Regedit.

• Regmon

v7.04 (11/1/2006)
This monitoring tool lets you see all Registry activity in real-time.

• RootkitRevealer

v1.71 (11/1/2006)
Scan your system for rootkit-based malware

• SDelete

v1.51 (11/1/2006)
Securely overwrite your sensitive files and cleanse your free space of previously deleted files using this DoD-compliant secure delete program. Complete source code is included.

• ShareEnum

v1.6 (11/1/2006)
Scan file shares on your network and view their security settings to close security holes.

• Sigcheck

v1.30 (11/1/2006)
Dump file version information and verify that images on your system are digitally signed.

• Streams

v1.53 (11/1/2006)
Reveal NTFS alternate streams

• Strings

v2.30 (11/1/2006)
Search for ANSI and UNICODE strings in binaryimages.

• Sync

v2.0 (11/1/2006)
Flush cached data to disk

• TCPView

v2.40 (11/1/2006)
Active socket command-line viewer.

• VolumeId

v2.0 (11/1/2006)
Set Volume ID of FAT or NTFS drives

• Whois

v1.01 (11/1/2006)
See who owns an Internet address.

• Winobj

v2.15 (11/1/2006)
The ultimate Object Manager namespace viewer is here.

• ZoomIt

v1.21 (1/19/2007)
Presentation utility for zooming and drawing on the screen.

Tuesday, February 13, 2007

Microsoft .NET Micro Framework Is Now Available

Today at Embedded World 2007, Microsoft Corp. announced the availability of the software development kit (SDK) for the Microsoft® .NET Micro Framework. With its ability to work seamlessly with Visual Studio®, the .NET Micro Framework extends the power of Microsoft’s embedded offerings into the realm of smaller, less expensive and more resource-constrained devices.

“The .NET Micro Framework was built from the ground up as a .NET solution for small embedded devices,” said Colin Miller, director of the .NET Micro Framework at Microsoft. “It brings the reliability and efficiency of the .NET environment to a new set of applications such as home automation systems, industrial sensors, retail displays and healthcare monitors. Development on this platform works seamlessly with the same tools that are used throughout the Microsoft family of platforms. This decreases the distinction between embedded application development and other application development tasks and helps reduce the cost and risks of these projects.”

“The .NET Micro Framework is a proven platform that opens up a new area of embedded development and adds to the momentum of Microsoft embedded technologies,” said Pieter Knook, senior vice president of the Mobile and Embedded Devices Division at Microsoft.

The .NET Micro Framework SDK enables developers to take full advantage of the C# development language and the rich development and debugging experience that Visual Studio provides. In addition, the SDK offers user-extensible hardware emulation and seamless, graphical debugging of emulated and real hardware to deliver robust solutions in less time than ever before.

The .NET Micro Framework SDK not only works seamlessly with Visual Studio and offers an extensible emulator, but is also supported by a number of hardware platforms based on the ARM7 and ARM9 processor cores. The framework also enables device developers to connect these hardware platforms to virtually any peripheral hardware through industry-standard communication connections and custom-managed drivers.

Those interested in receiving a copy of the SDK for the .NET Micro Framework can visit A minimum of 256 KB of RAM and 512 KB of flash ROM is required for development and deployment.

Partners Unveil Support and Offerings for .NET Micro Framework

Also at Embedded World, Digi International Inc. revealed plans for a preview release of the Digi Connect ME Development Kit for Microsoft .NET Micro Framework. The Digi Connect ME includes support for Ethernet networking, a serial port and general purpose input/output (GPIO) signals. It is the first solution available for .NET Micro Framework to support Ethernet networking. The kit, priced at $299 (U.S.), is available now from Digi’s online store ( and through its global network of distribution partners.

EmbeddedFusion, which delivers integrated hardware and software core solutions for embedded systems developers, announced the Meridian CPU, which is a core CPU module that incorporates a Freescale i.MXS processor, RAM, Flash and the .NET Micro Framework. To further assist developers in learning how the .NET Micro Framework is applicable in various embedded scenarios, EmbeddedFusion also created the Tahoe development platform, which enables experimentation and exploration of the .NET Micro Framework right out of the box.

Freescale also introduced a development kit for the .NET Micro Framework to allow customers to deliver differentiated solutions in the marketplace with ARM9 performance at very low power.

“Our expectations for .NET Micro Framework are high, so we continue to add features to enable OEMs, ODMs and others to create a new class of smaller, cost-efficient devices, or add Windows SideShow™ connected wirelessly to existing consumer devices,” said Brad Hale, manager of product management for Freescale’s multimedia applications division.

In addition, Rhode Consulting, a specialist in Microsoft Windows Embedded technologies, announced the availability of the FlexiDis Evaluation Kit with the .NET Micro Framework installed. The FlexiDis platform uses Atmel ARM7 and ARM9 processor cores with speeds of up to 180 MHz. The combination of these speeds, up to 16 MB of flash and SDRAM memory, and a 2.2-inch QVGA display makes the FlexiDis display a component of choice for various kinds of industrial applications in which an embedded HMI or visualization solution is required.

System Requirements for Developing on the .NET Micro Framework:

• Microsoft Windows® XP, Microsoft Windows Vista or Microsoft Windows Server® 2003

• Microsoft Visual Studio 2005 Standard Edition or greater

About .NET Micro Framework

The .NET Micro Framework grew out of the Smart Personal Objects Technology (SPOT) initiative at Microsoft. This framework is a natural extension of Microsoft’s offerings for creating embedded systems and provides an easy-to-use solution for this type of development. Though it is used on very small devices, the Microsoft .NET Micro Framework provides a managed code environment that brings a strong degree of efficiency and reliability to the realm of embedded software development. More information can be found at

Sunday, February 11, 2007

Ten SQL Server Functions That You Hardly Use But Should

Below are 10 SQL Server functions that are hardly used but should be used a lot more
I will go in more detail later on but here is a list of the ten functions that I am talking about

I also cross posted this here:


BINARY_CHECKSUM is handy if you want to check for data differences between 2 rows of data

In order to see what rows are in table 1 and not in table 2 and vice versa you can do 2 left joins, 2 right joins or 1 left and 1 right join. To get the rows that are different you can use BINARY_CHECKSUM. You have to run this example o SQL Server 2000 to see it work, you can ofcourse use any tables just modify the queries
Let’s get started…

--let's copy over 20 rows to a table named authors2
SELECT TOP 20 * INTO tempdb..authors2
FROM pubs..authors

--update 5 records by appending X to the au_fname

UPDATE tempdb..authors2
SET au_fname =au_fname +'X'

--Set rowcount back to 0

--let's insert a row that doesn't exist in pubs
INSERT INTO tempdb..authors2
SELECT '666-66-6666', au_lname, au_fname, phone, address, city, state, zip, contract
FROM tempdb..authors2
WHERE au_id ='172-32-1176'

--*** The BIG SELECT QUERY --***

--Not in Pubs
SELECT 'Does Not Exist On Production',t2.au_id
FROM pubs..authors t1
RIGHT JOIN tempdb..authors2 t2 ON t1.au_id =t2.au_id
WHERE t1.au_id IS NULL
--Not in Temp
SELECT 'Does Not Exist In Staging',t1.au_id
FROM pubs..authors t1
LEFT JOIN tempdb..authors2 t2 ON t1.au_id =t2.au_id
WHERE t2.au_id IS NULL
--Data Mismatch
SELECT 'Data Mismatch', t1.au_id
FROM( SELECT BINARY_CHECKSUM(*) AS CheckSum1 ,au_id FROM pubs..authors) t1
JOIN(SELECT BINARY_CHECKSUM(*) AS CheckSum2,au_id FROM tempdb..authors2) t2 ON t1.au_id =t2.au_id
WHERE CheckSum1 <> CheckSum2

--Clean up
DROP TABLE tempdb..authors2

Sometimes you are asked by the front-end/middle-tier developers to return a rowcount as well with the result set. However the developers want you to return 1 if there are rows and 0 if there are none. How do you do such a thing?
Well I am going to show you two ways. the first way is by using CASE and @@ROWCOUNT, the second way is by using the SIGN function

For CASE we will do this


So that's pretty simple, if @@ROWCOUNT is greater than 0 return 1 for everything else return 0

Using the SIGN function is even easier, all you have to do is this


That's all, SIGN Returns the positive (+1), zero (0), or negative (-1) sign of the given expression. In this case -1 is not possible but the other two values are
So let's see this in action

USE pubs

--Case Proc
@au_id VARCHAR(49) ='172-32-1176'
FROM authors
WHERE au_id =@au_id


--Sign Proc
@au_id VARCHAR(49) ='172-32-1176'
FROM authors
WHERE au_id =@au_id


--Case Proc, 1 will be returned; default value is used
DECLARE @Rowcount int
EXEC @Rowcount = TestReturnValues
SELECT @Rowcount

--Case Proc, 0 will be returned; dummy value is used
DECLARE @Rowcount int
EXEC @Rowcount = TestReturnValues 'ABC'
SELECT @Rowcount

--Sign Proc, 1 will be returned; default value is used
DECLARE @Rowcount int
EXEC @Rowcount = TestReturnValues2
SELECT @Rowcount

--Sign Proc, 0 will be returned; dummy value is used
DECLARE @Rowcount int
EXEC @Rowcount = TestReturnValues2 'ABC'
SELECT @Rowcount

--Help the environment by recycling ;-)
DROP PROCEDURE TestReturnValues2,TestReturnValues

COLUMNPROPERTY is handy if you need to find scale, precision, if it is an identity column and more. I have listed all of them below

CREATE TABLE blah (ID DECIMAL(5,2) not null DEFAULT 99)

SELECT COLUMNPROPERTY( OBJECT_ID('blah'),'ID','AllowsNull') AS AllowsNull,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsComputed') AS IsComputed,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsCursorType') AS IsCursorType,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsDeterministic') AS IsDeterministic,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsFulltextIndexed') AS IsFulltextIndexed,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsIdentity') AS IsFulltextIndexed,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsIdNotForRepl') AS IsIdNotForRepl,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsIndexable') AS IsIndexable,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsOutParam') AS IsOutParam,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsPrecise') AS IsPrecise,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','IsRowGuidCol') AS IsRowGuidCol,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','Precision') AS 'Precision',
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','Scale') AS Scale,
COLUMNPROPERTY( OBJECT_ID('blah'),'ID','UsesAnsiTrim') AS UsesAnsiTrim

So what does all that stuff mean?

Allows null values. 1 = TRUE
NULL = Invalid input

The column is a computed column. 1 = TRUE
NULL = Invalid input

The procedure parameter is of type CURSOR. 1 = TRUE
NULL = Invalid input

The column is deterministic. This property applies only to computed columns and view columns. 1 = TRUE
NULL = Invalid input. Not a computed column or view column.

The column has been registered for full-text indexing. 1 = TRUE
NULL = Invalid input

The column uses the IDENTITY property. 1 = TRUE
NULL = Invalid input

The column checks for the IDENTITY_INSERT setting. If IDENTITY NOT FOR REPLICATION is specified, the IDENTITY_INSERT setting is not checked. 1 = TRUE
NULL = Invalid input

The column can be indexed. 1 = TRUE
NULL = Invalid input

The procedure parameter is an output parameter. 1 = TRUE
NULL = Invalid input

The column is precise. This property applies only to deterministic columns. 1 = TRUE
NULL = Invalid input. Not a deterministic column

The column has the uniqueidentifier data type and is defined with the ROWGUIDCOL property. 1 = TRUE
NULL = Invalid input

Precision for the data type of the column or parameter. The precision of the specified column data type
NULL = Invalid input

Scale for the data type of the column or parameter. The scale
NULL = Invalid input

ANSI padding setting was ON when the table was initially created. 1= TRUE
NULL = Invalid input

Okay so you know the LEN function but do you know the DATALENGTH function? There are two major difference between LEN and DATALENGTH.
The first one deals with trailing spaces, execute the following code and you will see that LEN returns 3 while DATALENGTH returns 4


The second difference deals with unicode character data, as you know unicode uses 2 bytes to store 1 character
Run the following example and you will see that LEN returns 3 while DATALENGTH returns 6

If you do DATALENGTH(CONVERT(VARCHAR,@V)) you will get the same as LEN because LEN does a RTRIM and converts to VARCHAR before returning

ASCII will give you the ascii code for a character so for A you will get 65
CHAR does the reverse of ascii CHAR(65) returns A
UNICODE will give you the unicode value for a character
NCHAR will give you the character for a unicode or ascii value
let's see how this works


NULLIF Returns a null value if the two specified expressions are equivalent.

NULLIF ( expression , expression )

SELECT @v = ' '


You can combine NULLIF with COALESCE if you want to test for NULLS and Blanks for example

SELECT @v = ' '


Here is another NULLIF example:



--Using CASE
ELSE SomeCol END SomeCol

Output for both queries

PARSENAME retrieves parts of string delimited by dots. It is used to split DataBaseServer, DataBaseName, ObjectOwner and ObjectName but you can use it to split IP addresses, names etc

DECLARE @ParseString VARCHAR(100)
SELECT @ParseString = 'DataBaseServer.DataBaseName.ObjectOwner.ObjectName'


SomeField VARCHAR(49))

VALUES ('aaa-bbbbb')

VALUES ('ppppp-bbbbb')

VALUES ('zzzz-xxxxx')

FROM #Test

Another example:

CREATE TABLE BadData (FullName varchar(20) NOT NULL);
INSERT INTO BadData (FullName)
SELECT 'Clinton, Bill' UNION ALL
SELECT 'Johnson, Lyndon, B.' UNION ALL
SELECT 'Bush, George, H.W.';

Split the names into 3 columns

Your output should be this:
LastName FirstName MiddleInitial
Clinton Bill
Johnson Lyndon B.
Bush George H.W.

SELECT FullName,PARSENAME(FullName2,NameLen+1) AS LastName,
PARSENAME(FullName2,NameLen) AS FirstName,
COALESCE(REPLACE(PARSENAME(FullName2,NameLen-1),'~','.'),'') AS MiddleInitial
SELECT LEN(FullName) -LEN(REPLACE(FullName,',','')) AS NameLen,
REPLACE(REPLACE(FullName,'.','~'),', ','.') AS FullName2,FullName
FROM BadData) x

STUFF is another function that is hardly used, it is useful if you want to replace or add characters inside data
Take a look at the code below. the first STUFF will replace X with 98765, the second STUFF will place 98765 before the X and the third stuff will replace X- with 98765
SELECT @v ='-X-'

SELECT STUFF(@v, 2, 1, '98765'),
STUFF(@v, 2, 0, '98765'),
STUFF(@v, 2, 2, '98765')

The STUFF function is very handy if you need to insert dashes in a social security. You can accomplish that by using the function STUFF twice instead of using substring,left and right

SELECT @v ='123456789'

SELECT @v,STUFF(STUFF(@v,4,0,'-'),7,0,'-')

REVERSE just reverses the value, for example the code below returns CBA


Reverse is handy if you need to split values, take a look at this example

CREATE TABLE #TestCityStateZip (csz CHAR(49))
INSERT INTO #TestCityStateZip VALUES ('city ,st 12223')
INSERT INTO #TestCityStateZip VALUES ('New York City,NY 10028')
INSERT INTO #TestCityStateZip VALUES ('Princeton , NJ 08536')
INSERT INTO #TestCityStateZip VALUES ('Princeton,NJ 08536 ')
INSERT INTO #TestCityStateZip VALUES ('Long Island City, NY 10013')
INSERT INTO #TestCityStateZip VALUES ('Long Island City, NY 10013 ')
INSERT INTO #TestCityStateZip VALUES ('Long Island City , NY 10013')
INSERT INTO #TestCityStateZip VALUES ('Long Island City ,NY 10013 ')

SELECT LEFT(csz,CHARINDEX(',',csz)-1)AS City,
LEFT(LTRIM(SUBSTRING(csz,(CHARINDEX(',',csz)+1),4)),2) AS State,
FROM #TestCityStateZip


Returns the datetime value representing the current UTC time (Universal Time Coordinate or Greenwich Mean Time). The current UTC time is derived from the current local time and the time zone setting in the operating system of the computer on which SQL Server is running.

And that is all, those are the ten functions that you should be using but currently you are not using all of them. Look them up in Books On Line so that you can see some more examples