Monthly Archives: February 2010

Import SSIS package using DTUTIL

To import an SSIS dtsx package into SQL Server, use can use the DTUTIL utility with the following syntax:

dtutil /FILE <name>.dtsx /DESTSERVER SQLServer /COPY SQL;<name>

To import multiple SSIS dtsx packages into SQL Server, you can use a combination of the DTUTIL utility and the FOR batch command to load each dtsx file in a directory.

Execute the following command at a command prompt or from a command or batch file.

FOR %i In (*.dtsx) DO dtutil /FILE %i /DESTSERVER SQLServer /COPY SQL;DTSX_%~ni

What is the SOLID programming principle?

SOLID was introduced by Robert C. Martin and stands for the five principles of object-oriented programming and design that if following will create a system that is easy to maintain and extend.

The five principle of SOLID programming are:
1. Single responsibility principle - an object should only have a single responsibility.
2. Open/closed principle - open for extension, but closed for modification.
3. Liskov substitution principle - defines a notion of substitution of mutable objects.
4. Interface segregation principle - many specific interfaces are better than one general purpose interface.
5. Dependency inversion principle - depend upon abstractions.  Also known as inversion of control.

Kindle Development Kit coming next month

Amazon will release a Kindle Development Kit limited beta next month that will allow software developers to create apps for the Kindle.  The revenue share will be 70% to the developer and 30% to Amazon net of delivery fees of $0.15 / MB.

Pricing options include Free, One-time purchase, and Monthly Subscription.

Source: http://www.amazon.com/kdk/

SQL Server Analysis Services XMLA command to return a list of cubes in a catalog

To return a list of SQL Server Analysis Services cubes in a catalog, use the MDSCHEMA_CUBES request type.

For example, lets return a list of cubes for the Catalog1 SSAS catalog.

<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
  <RequestType>MDSCHEMA_CUBES</RequestType>
  <Restrictions />
  <Properties>
    <PropertyList>
      <Catalog>Catalog1</Catalog>
    </PropertyList>
  </Properties>
</Discover>

The MDSCHEMA_CUBES request type will return a list of SSAS cubes in XML format similar to the following.

<return xmlns="urn:schemas-microsoft-com:xml-analysis">
  <root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:schema targetNamespace="urn:schemas-microsoft-com:xml-analysis:rowset" 
                xmlns:sql="urn:schemas-microsoft-com:xml-sql" 
                elementFormDefault="qualified">
      <xsd:element name="root">
        <xsd:complexType>
          <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="row" type="row" />
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:simpleType name="uuid">
        <xsd:restriction base="xsd:string">
          <xsd:pattern value="[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]
                       {4}-[0-9a-zA-Z]{12}" />
        </xsd:restriction>
      </xsd:simpleType>
      <xsd:complexType name="xmlDocument">
        <xsd:sequence>
          <xsd:any />
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="row">
        <xsd:sequence>
          <xsd:element sql:field="CATALOG_NAME" name="CATALOG_NAME" type="xsd:string" />
          <xsd:element sql:field="SCHEMA_NAME" name="SCHEMA_NAME" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="CUBE_NAME" name="CUBE_NAME" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="CUBE_TYPE" name="CUBE_TYPE" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="CUBE_GUID" name="CUBE_GUID" type="uuid" minOccurs="0" />
          <xsd:element sql:field="CREATED_ON" name="CREATED_ON" type="xsd:dateTime" 
                       minOccurs="0" />
          <xsd:element sql:field="LAST_SCHEMA_UPDATE" name="LAST_SCHEMA_UPDATE" 
                       type="xsd:dateTime" minOccurs="0" />
          <xsd:element sql:field="SCHEMA_UPDATED_BY" name="SCHEMA_UPDATED_BY" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="LAST_DATA_UPDATE" name="LAST_DATA_UPDATE" type="xsd:dateTime" 
                       minOccurs="0" />
          <xsd:element sql:field="DATA_UPDATED_BY" name="DATA_UPDATED_BY" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="DESCRIPTION" name="DESCRIPTION" type="xsd:string"
                       minOccurs="0" />
          <xsd:element sql:field="IS_DRILLTHROUGH_ENABLED" name="IS_DRILLTHROUGH_ENABLED" 
                       type="xsd:boolean" minOccurs="0" />
          <xsd:element sql:field="IS_LINKABLE" name="IS_LINKABLE" type="xsd:boolean" 
                       minOccurs="0" />
          <xsd:element sql:field="IS_WRITE_ENABLED" name="IS_WRITE_ENABLED" type="xsd:boolean" 
                       minOccurs="0" />
          <xsd:element sql:field="IS_SQL_ENABLED" name="IS_SQL_ENABLED" type="xsd:boolean" 
                       minOccurs="0" />
          <xsd:element sql:field="CUBE_CAPTION" name="CUBE_CAPTION" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="BASE_CUBE_NAME" name="BASE_CUBE_NAME" type="xsd:string" 
                       minOccurs="0" />
          <xsd:element sql:field="CUBE_SOURCE" name="CUBE_SOURCE" type="xsd:unsignedShort" 
                       minOccurs="0" />
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
    <row>
      <CATALOG_NAME>Cube1</CATALOG_NAME>
      <CUBE_NAME>Top Level</CUBE_NAME>
      <CUBE_TYPE>CUBE</CUBE_TYPE>
      <LAST_SCHEMA_UPDATE>2009-09-22T15:49:12</LAST_SCHEMA_UPDATE>
      <LAST_DATA_UPDATE>2010-01-15T13:41:18</LAST_DATA_UPDATE>
      <DESCRIPTION>Cube1</DESCRIPTION>
      <IS_DRILLTHROUGH_ENABLED>true</IS_DRILLTHROUGH_ENABLED>
      <IS_LINKABLE>true</IS_LINKABLE>
      <IS_WRITE_ENABLED>false</IS_WRITE_ENABLED>
      <IS_SQL_ENABLED>true</IS_SQL_ENABLED>
      <CUBE_CAPTION>Cube1</CUBE_CAPTION>
      <CUBE_SOURCE>1</CUBE_SOURCE>
    </row>
  </root>
</return>

Sync Framework Power Pack for SQL Azure CTP

Microsoft Sync Framework Power Pack for SQL Azure November CTP is a set of tools to integrate the MS Sync Framework into Visual Studio 2008 Pro SP1 and SQL Server.

The tools in the power pack include:

  • SqlAzuerSyncProvider database provider
  • SQL Azure Offline Visual Studio Plug-in
  • SQL Azure Data Sync Tool for SQL Server
  • SQL Azure Events
  • Automated Provisioning

Before installing the power pack please ensure you have the Microsoft Sync Framework 2.0 SDK found here installed.

IE Application Compatibility VPC

Microsoft has release version 4.2 of its Internet Explorer Application Compatibility VPC Image which is a collection of Virtual PC virtual disk images for testing website with different Internet Explorer version on Windows XP and Windows Vista.

5 VPCs are available for download here including:

  • Windows XP SP3 with IE6
  • Windows XP SP3 with IE7
  • Windows XP SP3 with IE8
  • Windows Vista with IE7
  • Windows Vista with IE8

The latest version of Virtual PC can be downloaded for free here.

SQL Server Data Warehousing Tips

  1. If a table is larger than 50 Gb, partition it.
  2. Create indexed views that are aligned with your partitioned fact tables.
  3. If time is available, rebuild statistics after every load of data into the warehouse.
  4. Use the correct date / time data type.  Use date instead of datetime when you do not need to store the time.
  5. Use PAGE compression to reduce data volume and speed up queries.
  6. Use MOLAP write back instead of ROLAP write back.
  7. Use Analysis Services backup instead of file copy.
  8. For report performance, do as much in the query as possible including return only the level of detail displayed, filter, grouping, and sorting.
  9. Keep the report server catalog on the same computer as the reporting server.
  10. Place the reporting services on a different server from the data warehouse.

Migrate from MySQL to SQL Server

Microsoft released on January 7th the first CTP of a SQL Server Migration Assistant for MySQL.  The tool provides an assessment of migration efforts as well as automates schema and data migration from MySQL 4.1, 5.0, and 5.1 to SQL Server and SQL Azure.

2 versions are available, one for any edition of SQL 2005 and another for any edition of SQL 2008.  Both require a license key for activation which can be obtained after registering.  Toolkits for Oracle, Sybase, Access, and PowerBuilder are also available.

The Microsoft SQL Server Migration Assistant 2008 for MySQL CTP can be downloaded here.

The Microsoft SQL Server Migration Assistant 2005 for MySQL CTP can be downloaded here.

Create Index in Teradata

To create an Index in Teradata, use the following syntax:

CREATE [UNIQUE] INDEX <index_name>
(<column_names)
on <table_name>;

Create Table in Teradata

To create a table in Teradata, use the following syntax.

CREATE TABLE <schema>.<table_name>
(
    <column_name> <data_type> <column_attributes>
)
<column_constraints>

Data types may be one of the following:

INTEGER INTERVAL YEAR [(n)] INTERVAL SECOND [(n,[m])]
SMALLINT INTERVAL YEAR [(n)] TO MONTH CHAR [(n)]
BYTEINT INTERVAL MONTH VARCHAR(n)
DATE INTERVAL DAY [(n)] CHAR VARYING(n)
REAL INTERVAL DAY [(n)] TO HOUR LONG VARCHAR
DOUBLE PRECISION INTERVAL DAY [(n)] TO MINUTE BYTE [(n)]
FLOAT [n] INTERVAL DAY [(n)] TO SECOND VARBYTE(n)
DECIMAL [(n[,m])] INTERVAL HOUR [(n)] GRAPHIC[(n)]
DATE INTERVAL HOUR [(n)] TO MINUTE VARGRAPHIC(n)
TIME [(n)] [WITH TIME ZONE] INTERVAL HOUR [(n)] TO SECOND LONG VARGRAPHIC
TIMESTAMP [(n)] [WITH TIME ZONE] INTERVAL MINUTE [(n)]  
INTERVAL INTERVAL MINUTE [(n)] TO SECOND [(m)]  

 

Column attributes may be one of the following:

NOT NULL NAMED name DEFAULT NULL
UPPERCASE DEFAULT number WITH DEFAULT
[NOT] CASESPECIFIC DEFAULT USER CHARACTER SET
FORMAT quote_string DEFAULT DATE  
TITLE quote_string DEFAULT TIME  

 

Column constraints may be one of the following:

  • PRIMARY KEY
  • Ex: UNIQUE PRIMARY INDEX(<column_names>)
  • UNIQUE
  • Ex: UNIQUE INDEX(<column_names>)
  • CHECK (boolean_expression)
  • Ex: CHECK (<column_name> = 'F' OR <column_name> = 'M')
  • FOREIGN KEY (column_name_list)
  • Ex: FOREIGN KEY (<column_names>)
  • REFERENCES tablename [(column_name_list)]
  • Ex: REFERENCES <table_name> (<column_names>)