SQL Server & BI blog by Andreas Wolter: Database Engine - Reporting - Integration - Analysis Services

Andreas Wolter - SQL Server & BI blog (Database Engine, Reporting Services, Integration Services, Analysis Services)
Sessions auf der SQLCon 2011

Auch dieses Jahr bin ich wieder mit bis dato zwei Sessions auf der SQLCon 2011 – 26. – 29. September in Mainz vertreten.

Update (09/2011): Den Vortrag “Reporting Services in SQL Server Denali” habe ich zugunsten eines mir noch mehr am Herzen liegenden Themas gestrichen. (Außerdem werden die Reporting Services selber kaum viele Neuereungen in Denali erfahren)
Dafür halte ich eine Session zu den Sicherheits-Features & Techniken von SQL Server für Entwickler:

“Schutz gegen SQL Injection sollte mittlerweile zum Repertoire jedes Entwicklers gehören. Jedoch gibt es noch andere Wege, an sensible Daten zu gelangen oder sie zu manipulieren. In dieser demointensiven Session (Achtung: Code, Code) werden wir uns vor allem anderen Techniken widmen, die man im Repertoire haben sollte, die Sicherheit seiner Daten zu stärken. Dazu gehören Basics wie Schema-Design für Security, Besitzerketten und ihre Fallstricke, Codesignierung und Verschlüsselung für die kritischsten Daten.“

”Wer Berichte mit Reporting Services erstellt, wird feststellen, dass ganz schnell nach weiteren verlangt wird. Und früher oder später kommt der Ruf nach einem einheitlichen Aussehen. Die Unterstützung dafür out of the box ist eher schwach. Dennoch kann man mit geschickter Kombination der zur Verfügung stehenden Möglichkeiten eine starke Effizienz-Steigerung beim Erstellen neuer Berichte erreichen.“

 

Ich würde mich freuen, den einen oder anderen persönlich, “offline”, begrüßen zu können.

Andreas Wolter

Sarpedon Quality Lab

High-Level Training

sqlcon2011_extern_viewport

Standardizing and Centralizing Report Design (or: creating style sheets for reports) Part 3: The Style-Template

In the first part we learned how to integrate a Layout-Template into BIDS. The second technique in this series we are looking at will be using the “Style-Template”.

What is a Style-Template?:

Style-Templates are a set of definitions such as font size, font type, font color, background color, border styles, etc., which is being used from within the “Add New Report” wizard inside Business Intelligence Development Studio.

Report Layout-Templates are shown in the Project-Dialogue “Add“ – “New Item“ .

image

This is where you usually chose among those beautiful styles, that Microsoft provides you with (Slate, Forest, Corporate, Ocean, Bold, Generic) Open-mouthed smile.

image

But: you can include your own style definition!

And this is how we can create a Style-Template:

1) Open the file StyleTemplates.xml from the following location (watch for your locale specific folder at the end) using your favorite XML Editor (notepad is sufficient):

for Reporting Services 2005

    •%ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Business Intelligence Wizards\Reports\Styles\en

for Reporting Services 2008 x64

    •%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Business Intelligence Wizards\Reports\Styles\en

for 32-bit Reporting Services 2008

  • C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Business Intelligence Wizards\Reports\Styles\en

2) I strongly advice you create a backup of StyleTemplates.xml before you edit it:

3) Look for a complete “StyleTemplate”-node like “<StyleTemplate Name="Slate"> … </StyleTemplate>” and copy it to the end, just before the Generic-Style (<StyleTemplate Name="Generic">)

4) Rename the copied definition

5) Now you can start changing colors, border styles, fonts etc.

You will find out, that not everything will be accepted. There is no documentation and so far this is what I can give you as a set of rules I found out the hard way – hope it helps saving you time:

Rules of engagement for producing a Style-Template:

  • Backup StyleTemplates.xml before editing it!
  • Watch out for whitespaces and line breaks. Otherwise you will get Error messages such as “Red is not a valid color”.
  • Not all Attributes are supported and give you an error when running the wizard.
    • I.e. <TopBorder> etc.
  • Some fail silently like “<BorderWidth>”
  • Color values have no spaces between words
    • “Dark Olive Green” is coded “DarkOliveGreen”
  • Font names can include spaces
    • <FontFamily>Times New Roman</FontFamily>
  • TextAlign does not work in "Table Header" – sometimes align in header rows is out of order for no reason
  • default font for table does not work here either

Sample Style-Template code:

<StyleTemplate Name="Pizza_Time">
    <Label>Pizza_Time</Label>
    <Styles>
        <Style Name="Title">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>20pt</FontSize>
            <Color>Red</Color>
            <TextDecoration>Underline</TextDecoration>
        </Style>
        <Style Name="Page Group Level 1">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>14pt</FontSize>
        </Style>
        <Style Name="Page Group Level 2">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>12pt</FontSize>
        </Style>
        <Style Name="Page Group Level 3+">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>10pt</FontSize>
        </Style>
        <Style Name="Table"></Style>
        <Style Name="Matrix"></Style>
        <Style Name="Table Header">
            <BackgroundColor>Tomato</BackgroundColor>
            <FontFamily>Tahoma</FontFamily>
            <FontSize>11pt</FontSize>
            <FontWeight>Bold</FontWeight>
            <Color>White</Color>
            <BorderStyle>
                <Default>Solid</Default>
            </BorderStyle>
            <BorderColor>
                <Default>DimGray</Default>
            </BorderColor>
        </Style>
        <Style Name="Group Level 1">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>11pt</FontSize>
            <FontWeight>Bold</FontWeight>
            <Color>DarkOliveGreen</Color>
            <BackgroundColor>Wheat</BackgroundColor>
            <BorderStyle>
                <Default>Solid</Default>
            </BorderStyle>
            <BorderColor>
                <Default>DimGray</Default>
            </BorderColor>
        </Style>
        <Style Name="Group Level 1 Textbox">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>11pt</FontSize>
            <FontWeight>Bold</FontWeight>
            <Color>DarkOliveGreen</Color>
            <BackgroundColor>Wheat</BackgroundColor>
            <BorderStyle>
                <Default>Solid</Default>
            </BorderStyle>
            <BorderColor>
                <Default>DimGray</Default>
            </BorderColor>
        </Style>
        <Style Name="Group Level 2">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>10pt</FontSize>
            <FontWeight>Bold</FontWeight>
            <Color>DarkOliveGreen</Color>
            <BackgroundColor>LightSalmon</BackgroundColor>
            <BorderStyle>
                <Default>Solid</Default>
            </BorderStyle>
            <BorderColor>
                <Default>DimGray</Default>
            </BorderColor>
        </Style>
        <Style Name="Group Level 2 Textbox">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>10pt</FontSize>
            <FontWeight>Bold</FontWeight>
            <Color>DarkOliveGreen</Color>
            <BackgroundColor>LightSalmon</BackgroundColor>
            <BorderStyle>
                <Default>Solid</Default>
            </BorderStyle>
            <BorderColor>
                <Default>DimGray</Default>
            </BorderColor>
        </Style>
        <Style Name="Detail">
            <FontFamily>Tahoma</FontFamily>
            <FontSize>10pt</FontSize>
            <FontWeight>Bold</FontWeight>
            <Color>White</Color>
            <BackgroundColor>LimeGreen</BackgroundColor>
            <BorderStyle>
                <Default>Solid</Default>
            </BorderStyle>
            <BorderColor>
                <Default>DimGray</Default>
            </BorderColor>
        </Style>
    </Styles>
</StyleTemplate>

You can of course include several sets of Style-Templates.

How to test?

Just run the “Add new Report”-wizard from inside BIDS, and you will see your own style appear in the list. Unfortunately there will be no picture-preview for user defined styles, so use a descriptive name.

image

And again, just like the Layout Templates, you could xcopy deploy this folder to all your Developers machines.

How about “centralizing”?

  • Just as Report Layout Templates you can “xcopy deploy” this folder regularly to all your Developers machines.
  • But again: once the reports are created, and you make a change to the originating template, existing reports will not be touched.

How about “standardizing”?

  • If you “xcopy deploy” this folder regularly to all your Developers machines, all developers can easily use the same colors and fonts for newly created tables & matrixes.

In short: What Style-Templates can be used for:

  • If you like using the „New Report“-wizard for quickly starting a report:
  • Have the first Table or Matrix finalized with the corporate-design colors and font-styles
  • Includes a report-title and body-color

Note:

  • Does NOT apply to elements added thereafter
  • Once the report is created, the style is hard-coded

 

References:

the only reference with code samples on the web is this post from 2004 here by a Microsoft guy:
http://www.ms-news.net/f3037/styletemplates-xml-tags-2920674.html#post9344712

The second link I’ll provide just gives a general overview over the two methods “Report (Layout) Template” and “Report Style Template”:
http://blogs.microsoft.co.il/blogs/yanivy/archive/2010/08/03/create-custom-templates-and-styles-for-ssrs-2008.aspx

 

In the next Part of the series, I will show how to use custom code for managing style.

Andreas

Sarpedon Quality Lab

Standardizing and Centralizing Report Design (or: creating style sheets for reports) Part 2: The Layout-Template

As a first technique in this series we will look at what I will call “Layout template”.

I chose the Term “Layout-Template” for two reasons:

first: the main thing that they can be used for is, to define general report sizing, footer and header elements – in other words, the overall layout of the report.

secondly: in the next part of this series we will see a different type of template which will actually be called “Style-Template”.

 

So, what is a Layout-Template?:

A Report Template can be as simple as a standard report with a certain page width and height, certain colors, a standard company logo etc., which can be copied over and over again.

Here the Problem is, how to avoid to overwrite the defined Report Template unintentionally, and, how to make it easily available.. even (report-)project-independent.

And this is where “Layout-Templates” come at hand.

 

Report Layout-Templates are shown in the Project-Dialogue “Add“ – “New Item“ .

image

There you can choose a Template and it will create a copy local to your project – and not overwrite the Rdl at its original location.

And this is how we create a Report Layout-Template:

1) Simply create a regular report, configure size, header and footer and so on. You could create a data region, but it would make little sense – just as a sample maybe.

2) Then you put the .rdl-file in the following location:

for Reporting Services 2005

  • %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject

for Reporting Services 2008 x64

  • %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject

for 32-bit Reporting Services 2008

  • C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject

3) and when you right-click at the reports-node in your project, click “Add“ and then chose “New Item“, your Report Templates will appear in the “Add New Item” box:

image

That’s it. Very simple.

How about “centralizing”?

  • You can “xcopy deploy” this folder regularly to all your Developers machines.
  • But: once the reports are created, and you make a change to the originating template, existing reports will not be touched.

How about “standardizing”?

  • If you “xcopy deploy” this folder regularly to all your Developers machines, all your reports should have the same Layout in terms of sizing, header&footer.

In short: What Layout-Templates can be used for:

  • Having predefined report size, (i.e. landscaped and portrait version)
  • Include report-header and footer with corporate design and navigational elements
  • Can even include sample data-regions with appropriate fonts and colors

 

In the next Part of the series, you will see how to create and use a Style-Template.

Andreas

Sarpedon Quality Lab

Standardizing and Centralizing Report Design (or: creating style sheets for reports) Part 1: The possibilities

While SQL Server 2011 (Denali) is at horizon, bringing up many changes in the way reports will be developed, Developers using SQL Server 2005, 2008 or 2008 R2 are still faced with on problem from the very first report on: How can I make not only development easier by having a template for reports at hand, but also, how to manage it.

Whereas in the area of webdesign, it is absolutely common to have a (cascading) style sheet to be referred to in all website-documents, in reporting services this concept does not exist.
While this is very annoying and it seems that it should be easy to implement at first, one has to remember, that Reporting Services does not just render to html, but at the same time Reporting Services have to be equally prepared to render Reports to Excel-Files, pdf-Files, TIFF-Image-Files, among others. So using the same technique as websites do, would simply to narrow.
There is a case at Microsoft Connect, where you can vote on this feature to get implemented in an upcoming version: http://connect.microsoft.com/SQLServer/feedback/details/253976/add-style-or-stylesheet-or-template-to-reporting-services-reports

In short: In Reporting Services there is no such one thing as ONE and only style sheet that does all magic for you.
This blog-series is intended to show you the existing techniques, and how to combine them. In the end your effectiveness in creating an managing Reports style-wise can be improved by a magnitude. But: there is work to do beforehand.

I spend quite a while, reading other blogs, the rare documentation and doing my own tests. Finally I had the honor of presenting a whole session on this matter at the European PASS Conference 2009.

In the following posts I will concentrate on the existing techniques I identified as the most useful techniques and combination.

Those are the techniques I will focus on:

The Basic Techniques:

Custom methods:

  • Using Custom Code
  • Using an Assembly
  • Using plain T-SQL

Combining techniques:

  • Style Template + Layout Template
  • Style Template + Custom style + Layout Template

Reporting Services 2008 R2 techniques

  • Shared DataSet
  • Report Part

 

I also tested using XML-Files as well as making a webservice-call to get Style-data, but this turned out to be rather pathological and is therefore left out from further consideration.

In the next Part of the series, I will show how to create and use a Layout-Template.

 

Andreas

Sarpedon Quality Lab

Preview of SQL Server 2011, Codename Denali CTP 1 presented at PASS Summit 2010 in Seattle

Sql_Server_2011_Denali

This year’s PASS Summit again surpassed the former year’s one. And this was not only because of even more sessions, internationally well-known speakers and even more attendees. This November, the next release of SQL Server was officially being introduced to the public, and the first CTP is ready for download for the broad public.

The improvements and features are enormous. Developers can look forward to a new Development Environment (Project Juneau), and new capabilities and performance using the new Filetable-Feature, as well as super fast response through the new Column-Based Query Accelerator technology.

Analysis Services will be receiving a new engine, based on the Vertipaq (known from PowerPivot), called BI Semantic Model for easier development for less complex BI Projects. (The UDM will stay as an alternative)
Here is a link to the Technet article on “Analysis Services – Roadmap for SQL Server “Denali” and Beyond”.

Integration Services ware becoming a true windows service for central execution and management.

image

Reporting Services users and developers can look forward to an web-integrated report designer together with interactive and dynamic charts. (Project Crescent)

Administrators gain new possibilities regarding security with customizable Server roles and database-only users. Database-only users are especially meant to support the new “Contained database”-Feature, which eases the deployment and movement of databases together with the depending objects from server scope.
(You can find a good high-level overview on the log-on process of database-only users at this msdn blog-post: http://blogs.msdn.com/b/sqlsecurity/archive/2010/12/08/contained-database-authentication-in-depth.aspx. And here is a great blog-post, going through different scenarios with this feaure: http://sqlblog.com/blogs/aaron_bertrand/archive/2010/11/16/sql-server-v-next-denali-contained-databases.aspx.)

High Availability will be eased by combining the log-shipping, database-mirroring and Clustering features under a new concept of “Always on” technologies, which can be used to form a so called “Availability Group”.

Steffen Krause from Microsoft Germany has some more info on the Denali release and also shows demos in his webcasts: http://blogs.technet.com/b/steffenk/archive/2010/11/15/sql-server-denali-ctp-1-verf-252-gbar-was-ist-neu.aspx

If you want to check out the CTP yourself, here is the link: http://www.microsoft.com/sqlserver/en/us/product-info/future-editions.aspx

Enjoy,

Andreas

Sarpedon Quality Lab

Security-issue: guest-guest impersonation

Almost a year ago I discovered an issue with SQL Server (all Versions from 2005 – 2008 R2, haven't tested 2000) regarding the usage of the guest-account and impersonation.

It also was presented by Ralf Dietrich and me at the SQL Server PASS Summit 2009 in Seattle where we informed Microsoft about it. - Thanks to Jack Richins from Microsoft for helping me find the root cause. (MSDN-blog post)

Unfortunately, a fix hasn’t been provided for SQL Server yet. As I was informed it will only be fixed in the next major version, Codename “Denali”. Here is the Connect-Item: https://connect.microsoft.com/SQLServer/feedback/details/509379/guest-activated-in-2-databases-leads-to-inconsistent-behaviour-and-may-also-compromise-security

Recently I demonstrated this technique again at the SQLCon in Mainz/Germany and now feel that I should blog about this.

 

This issue applies in a couple of scenarios, a more common of which I want to show here.

 

One scenario is, that sometimes or even often, developers, whether external or not, are given excessive rights in a certain database – on the same Server, where other databases exists, which may contain “public” data. But “public” maybe only for internal usage and not for external developers.

This is accomplished the following way: the database, let’s call it “InternalPublicData” will have the guest account enabled, and guest has permissions to see whatever is of interest for internal stuff.

In order to prevent access to this database for a certain Login, a database-user will be explicitly created in this database, so the Login does not match to guest and will be denied any resources in this database. One could even deny Connect-permission to the database, to secure it even more.

But this doesn’t help either, as you will see.

Also there is the database where the developer will have full permissions so he can work in his database and do anything inside. He might be dbo or member of the db_owner-role. (Unfortunately quite common because of the restrictions when using db_ddladmin etc.)

And now the trouble begins: The developer, let's call him “Dev0” cannot successfully connect to the InternalPublicData-database and act as guest there. But what he can do is the following: he can enable guest in his very own database.

Doing that, he can impersonate his local guest and then, not being “Dev0” any more, go to the InternalPublicData-database and successfully connect.

At that stage, he already has all permissions that the remote guest-account already has directly attached to it. But that’s not all. He can then do a second impersonate and gain role-memberships of the guest at the InternalPublicData-database!

No "Deny" for Dev0 can prevent that!

 

As a second option, he could, with permissions of creating a “User without Login“, impersonate that User and use it to jump to other databases where guest-is active…

 

The following is a script to demonstrate:

--Login:
CREATE LOGIN Dev0
    WITH PASSWORD = 'Pa$$w0rd'
GO

/* setup DBs*/
create database InternalPublicData;
create database DevelopmentDB;
GO

--Target-DB
use InternalPublicData;
grant connect to guest;

create table t1(c1 int)
insert into t1 values(1)

create table t2(c1 int)
insert into t2 values(2)

GRANT SELECT
ON dbo.t1
TO guest    -- and only guest

exec sp_addrolemember 'db_datareader', 'guest'    -- just to point out the fact that these guest-accounts are actually different even further

CREATE USER Dev0 FOR LOGIN Dev0    -- no memberships, so denied everything and not matching to guest automatically

DENY CONNECT TO Dev0    -- to make SURE!

-- DB 2
use DevelopmentDB;

CREATE USER Dev0 FOR LOGIN Dev0

EXEC sp_addrolemember N'db_owner', N'Dev0'
GO

GO

/* Setup finish */

/* Session as Dev0 */

EXECUTE AS LOGIN = 'Dev0'

-- Who and Where am I
SELECT CURRENT_USER AS CURRENT_USER_Name
    , SYSTEM_USER AS SYSTEM_USER_Name
    , ORIGINAL_LOGIN() AS ORIGINAL_LOGIN_Name
    , DB_NAME() AS Current_Database

use InternalPublicData;    -- not possible with Deny Connect

SELECT * FROM t1    -- with no Deny connect he gets denied here

execute as user = 'guest';        -- he can NOT do this at the remote DB (good so far)

-- Part One:

-- go back
USE DevelopmentDB

execute as user = 'guest';        -- not active

grant connect to guest;    -- but as a "Dev" with excessive permissions he can do what he wants
exec sp_addrolemember 'db_datawriter', 'guest'    -- just so that one can differentiate the guest accounts easier

execute as user = 'guest';        -- now we are in the game

-- Who and Where am I
SELECT CURRENT_USER AS CURRENT_USER_Name
    , USER_NAME()    AS DBUser
    , SYSTEM_USER AS SYSTEM_USER_Name
    , ORIGINAL_LOGIN() AS ORIGINAL_LOGIN_Name
    , DB_NAME() AS Current_Database

select * from sys.user_token;    -- now he became guest in DevelopmentDB for real

-- End of Part One

-- Part Two: using guest for executing as guest

USE InternalPublicData;        -- we connected as guest - no Deny for Dev0 Applying!!

SELECT CURRENT_USER AS CURRENT_USER_Name
    , USER_NAME()    AS DBUser
    , SYSTEM_USER AS SYSTEM_USER_Name
    , ORIGINAL_LOGIN() AS ORIGINAL_LOGIN_Name
    , DB_NAME() AS Current_Database
select * from sys.user_token;    -- he became guest in the remote-DB

SELECT * FROM dbo.t1        -- permissions at User(guest)-Level already working!

SELECT * FROM dbo.t2        -- not working because permission for role not applying

-- BUT: switch to InternalPublicData guest explicitely
execute as user = 'guest';        --NOW "Dev0" can do it in the Target-DB

SELECT CURRENT_USER AS CURRENT_USER_Name
    , USER_NAME()    AS DBUser
    , SYSTEM_USER AS SYSTEM_USER_Name
    , ORIGINAL_LOGIN() AS ORIGINAL_LOGIN_Name
    , DB_NAME() AS Current_Database
select * from sys.user_token;    -- he became guest with group-membership in Target-DB

SELECT * FROM dbo.t2            -- can now also read datathrough role-membership

-- End of Part Two: using guest for executing as guest
/* back off step by step */

USE InternalPublicData
revert;

USE DevelopmentDB
revert;

revert;

USE InternalPublicData
revert;

/* Finished */

USE master;
DROP DATABASE InternalPublicData;
DROP DATABASE DevelopmentDB;
DROP LOGIN Dev0

 

There is just one option to be sure that your system is safe from developers: don’t mix production with development – not even on server-level!

This should be absolutely clear, but I’ll repeat that, as long as I see mixed environments at customers' sites. Unfortunately, this is very common.

And secondly: never use the guest account for data that is not really supposed for everyone.

 

Sarpedon Quality Lab

HighLevelTraining.de

Scripting Table Data with SQL Server 2008 R2

I recently was asked, whether the Feature “Script Data” as T-SQL-command INSERT INTO… has been removed in SQL Server 208 R2.

In fact, it was not visible on first sight.

This is how you can find it:

It is still the right-click “Tasks” - “Generate Scripts” –Wizard.

After having chosen the Table(s), the following window appears:

SQL_2008R2_Set_Scripting_Options

there click “Advanced” and scroll down inside the “General”-part until the Element “Types of data” to script

image

And there under the following drop-down, it is hidden:

Types_of_data_to_script_drop_down

And the German translation “Datentypen, für die ein Skript erstellt wird”, makes it even harder to detect:

Erweitere_Skriptoptionen

Conclusion: Scripting out Data with “INSERT INTO”-commands is a bit hidden – (under SQL 2008 it was under the “Table/View Options”, now under “General” – “Types of data to script”) but still available :-)

 

www.andreas-wolter.com

Addresses for geographical Data, ESRI-Shapefiles and other SQL Server geographical related stuff

SQL Server 2008 R2 Reporting Services supports the visualization of geographical data in 3 ways.

  • Datasets, based on the built-in .Net System-datatypes “geography” and “geometry”, which have been around since SQL Server 2008
  • via built-in maps – but only for the United States
  • via ESRI-Shapefiles, which one has to provide on his own

Now, where can you get those Shape-files?

Other, than in the USA where gathered data belongs to the people, with no cost (Census Bureau Geography), in other countries, such as in Germany, it is by far not easy, to even get such datat all.

In the following, I am collecting internet-sites, where one can find geographical data. I'd be happy to include more URLs, if you found a good one, to share.

 

Spatial Data at MIT
http://libraries.mit.edu/gis/data/index.html
several links to other map-data, even outside US
MapCruzin.com
http://www.mapcruzin.com/...
free maps from around the world. political as well as physical, some even down to street-/building-level
Natural Earth
http://www.naturalearthdata.com/downloads/
several maps of the world with borders and physical structure
Bundeswahlleiter
http://www.bundeswahlleiter.de/...
maps of German "Wahlkreise", nice to play around with. They even include votes per area
http://www.datendieter.de various kinds of  datasets, also geographical, mainly German – mostly for a fee, but some is also free
   

Miscellaneous:

Other:

MsSQLSpatial http://mssqlspatial.codeplex.com/ spatial datatype-extension for SQL Server 2005
Spatial Tools with Shapefile Uploader

http://www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools.aspx

Tools for importing ESRI-Shapefiles into SQL Server as well as for looking at the data

 


Further good articles concerning geographical data and SQL Server:

Creating your own SSRS map using Visio

http://blog.oraylis.de/2010/07/creating-your-own-ssrs-map-using-visio/

Using Visio and SSRS Map Reports for Store Layouts etc.

http://blog.oraylis.de/2010/06/using-visio-and-ssrs-map-reports-for-store-layouts-etc/

Using ESRI ShapeFiles with SSI

http://ssis-components.net/post/2010/04/11/ESRI-ShapeFiles-verarbeiten.aspx

For importing shape-files into SQL Server, see this blog-post at MSDN: http://blogs.msdn.com/seanboon/archive/2009/11/17/sql-server-2008-r2-map-tips-how-to-import-shapefiles-into-sql-server-and-aggregate-spatial-data.aspx

Achieve Spatial Data Support in SSIS:
http://www.sql-server-performance.com/articles/biz/spatial_data_support_ssis_p1.aspx

Bridge The Gap between Bing and Google Maps using SSIS
http://www.sql-server-performance.com/articles/biz/bing_google_maps_p1.aspx 

Heat Maps as Reports

http://prologika.com/CS/blogs/blog/archive/2009/08/30/heat-maps-as-reports.aspx

Stacia Misner shows in her blog, how to include your maps in the Map-Gallery for the Map-Builder-Wizard:

http://blog.datainspirations.com/2010/08/31/do-it-yourself-map-gallery-in-sql-server-2008-r2-reporting-services/

Rob Farley shows, how you can geocode you address-data using bing-maps and powershell:

http://sqlblog.com/blogs/rob_farley/archive/2010/05/23/fetching-latitude-and-longitude-co-ordinates-for-addresses-using-powershell.aspx

 

Have fun with Reporting Services 2008 R2

Andreas


Sarpedon Quality Lab

Integration Services: Looping & “continue on error”

 

Eine häufige Aufgabe bei der Arbeit mit Integration Services Paketen ist es, eine Routine in einer Schleife auszuführen.

Nehmen wir den konkreten Fall: ein For Each-Loop zum rekursiven Auslesen von Textdateien aus einer Verzeichnisstruktur und Verschieben an einen Zielort.

Wenn die Operation aufgrund von einer geöffneten Datei (z.B. der Log-Writer Prozess) fehlschlägt, schlägt damit der Task “Move file” fehl. Sodann der Container “For Each Loop”, und dann das gesamte Paket. Das ist das Standardverhalten: das Event “Error” wird propagiert.

Das sieht in etwa so aus (hier mit einen For Loop):

SSIS_EventPropagation_standard

Man sieht trotz der versuchten “Fehlerbehandlung” in dem Script-Task “SCR-Fail” schlägt der Container fehl.

Das ist in diesem Fall aber nicht unbedingt das gewünschte Ergebnis.
Man möchte, das die Operation einfach mit der nächsten Datei fortfährt und eventuell liegengebliebene Dateien in einem späteren Durchlauf einfach holen.

Dafür muss man das propagieren des Fehlers auf Container-Ebene unterbinden. Die dafür extra vorhandene Systemvariable “Propagate” ist ausnahmsweise deswegen auch manuell änderbar. Allerdings gibt es diese nur in den Event Handlern.

Das heisst für den fehlschlagenen SQL-Task in diesem Beispiel ist ein EventHandler für “OnError” anzulegen. Dort findet man dann die besagte Variable und schaltet sie auf False

SSIS_EventPropagation_SystemVariablePropagate 

 

Das würde an sich schon genügen, um das Paket einfach weiterlaufen zu lassen.

Allerdings ist es in der Regel wünschenswert, im Anschluss eine bedingte Reaktion auf das erfolgreiche oder erfolglose Verschieben der Datei erfolgen zu lassen. In diesem Beispiel ein T-SQL-Schritt bei Erfolg, und der Script-Task “Fail” bei Misserfolg.

Da nun kein Fehler mehr propagiert wird, ist ein kleiner Kunstgriff vonnöten: Man definiert sich eine Variable, welche im Fehlerfall einen anderen Wert erhält und liest diese dann bei dem Precedence-Constraint zusätzlich mit aus.

Am einfachsten geht das mit dem im Fehlerfall ohnehin vorhandenen ErrorCode – innerhalb des EventHandler natürlich.

Dort leitet man den Wert der Systemvariable “ErrorCode” einfach in seine eigens zuvor angelegte User-Variable um:

Dts.Variables("User::ErrorCode").Value = Dts.Variables("System::ErrorCode").Value

Im ControlFlow wird dann ein “OnCompletion” – Precedence Constraint verwendet, und zusätzlich die Variable in der Expression "@[User::ErrorCode] != 0" ausgewertet

Das gewünschte Ergebnis verhält sich dann so:

SSIS_EventPropagation_Result

Der Fehler im Task wird abgehandelt, und die Arbeit wird fortgesetzt.

 

happy coding :)

 

Andreas Wolter


Sarpedon Quality Lab

SQLCon Session “Anspruchsvollere Berichte mit Reporting Services 2008”

Auf der diesjährigen SQLCon in Mainz hielt ich die Session Anspruchsvollere Berichte mit Reporting Services 2008.

Link: http://it-republik.de/dotnet/sqlcon09/sessions/?tid=1259#session-10624

Themen waren:

Tablix

–Mehrere Gruppen auf einer Achse
–Static Header – wie geht das jetzt?
–Listen (gruppieren)

Tablix_with_multiple_Groups

Charts

–Dynamisches Wachstum
–Trendlines einbauen, Pareto-Charts
–Multiple Charts

dynamic_chart_size

chart_calculates_series

Gauges

–Varianten und Customizing

Gauges

Kombinationen

–Charts und Gauges innerhalb von Tablix (Microcharts)

Microcharts

Weitere „Angenehmlichkeiten“

–Felder in Page Header & Footer
–Placeholder

Hinweise auf Weitere interessante Neuerungen

Ausblick SQL Server 2008 R2

–Map Control
–Componentizing Reports

Map

 

bis zum Nächsten mal,

 

Andreas Wolter


Sarpedon Quality Lab

Neuer Webauftritt + Gewinnspiel

Liebe SQL Server Administratoren, Entwickler und Entscheider.



Seit Juni 2009 erreichen Sie unter www.SarpedonQualityLab.com unsere neue Webseite .

Dort finden Sie neben einem Überblick über unsere Dienstleistungen auch Informationen über unsere neues Produkt, das wir in intensiver Arbeit an SQL Server Installationen entwickelt haben:
SQL Server Suite Monitoring
, aktuell in der Version 3.1 verfügbar.

Außerdem sind Sie herzlich eingeladen an unserer Verlosung teilzunehmen. Zu gewinnen sind unter anderem 3 Tage Teilnahme an der SQL Con 2009 oder ein  ganzer Trainingstag!

Update: Die Verlosung ist beendet- Wir gratulieren den Gewinnern.

Weitere Informationen dazu finden Sie auf unserer Website im Bereich Neuigkeiten.

 
Mit sonnigen Grüßen aus Düsseldorf,
 

Ihr Sarpedon Quality Lab Team

 

Sarpedon Quality Lab

 

weitere Präsenzen:

High-Level Training

Andreas Wolter Training & Consulting

SQL Server Suite Trainings

 

Reporting Services 2005 on Windows Server 2008 (+ Vista) or Windows 2008 R2 (+ Windows 7) - IIS configuration

Many still use SQL Server/Reporting Services 2005 although sometimes alread on Windows Server 2008 / Vista / Windows 7.

I absolutely do recommend upgrading to SQL Server 2008. There are many advantages in the combination - be it security or performance (Security, Performance, No need for IIS) - but if you can't uprade right now, you do need to install IIS for Reporting Services 2005 to run.

I have seen recommendations (even on a Microsoft blog) where they tell you to install EVERY Role Service for IIS - but that is untrue and against basic security principles.

I always always recommend "install as little as possible, but just as much as required".

You do not need an FTP-Server to run Reporting Services! - Natural to most. But when it comes to less known features like, CGI , SSI, Tracing..?.. most aren't so sure.

So here is the definite list of required role services for IIS. I tried to leave of everything I could, and this turned out:

 

Web Server

Common HTTP Features

   Static Content

   Default Document

   HTTP Errors

   HTTP Redirection

Application Development

   ASP.NET

   .NET Extensibility

   ASP

   ISAPI Extensions

   ISAPI Filters

Health and Diagnostics

   HTTP Logging

   Request Monitor

Security

   Windows Authentication

   Request Filtering

Performance

   Static Content Compression

Management Tools

   IIS Management Console

   IIS 6 Management Compatibility

   IIS 6 Metabase Compatibility

   IIS 6 WMI Compatibility

   IIS 6 Scripting Tools
 
   IIS 6 Management Console


I also attach a cmd-file. This file will install all the required packages by itself. You do not need to don any IIS Installation beforehand. It's using the new Package Manager available on Windows Server 2008. Just remove the .txt after you checked it out ;-

If You are using Windows Server 2008 R2/Windows 7 with IIS 7,5, Package Manager is deprecated. Instead use Deployment Image Servicing and Management as described here: http://blogs.msdn.com/b/habibh/archive/2009/08/14/how-to-install-iis-7-5-on-windows-7-using-the-command-line.aspx

I also prepared a file using DISM, which you can download here.

For Some reason though the Packetmanager installs "Directory Browsing, which is NOT required (bull***) - you should remove it manually. This seems to be a bug with Package Manager.

At the end it should look like this:
IIS on Windows Server 2008 for Reporting Servives 2005

 

 IIS will be properly detected (and we know for sure, that "Directory Browsing" is not a requirement"):

 System_Configuration_Check_Sql_Server_2005_Setup_IIS_Reporting_Services

 

There is still something however:

After you installed and navigate to http://YourServername/Reports

You will get an error: "unable to connect to remote server"

when checking the Logfile  "ReportServerWebApp" it says:

 

w3wp!ui!7!22.10.2008-10:24:47:: e ERROR: Unable to connect to the remote server
w3wp!ui!7!22.10.2008-10:24:47:: e ERROR: HTTP status code --> 500
-------Details--------
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---

 

Solution:

In IIS 7 Manager, highlight the ReportServer application (Not "Reports")

go to Handler Mappings, click "Edit Feature Permissions" in the "Actions Pane", and enable "Script and Execute".

IIS_Manager_Handler_Mapping_for_Reporting_Services_2005

 

You are all set - it should be running just fine now.

Everything described here also applies for running Reporting Services 2005 on Windows Vista (SP1).

Download to IIS 7 Setup-File using Package Manager (rename to .cmd or .bat)

Download to IIS 7.5 Setup-File using DISM (rename to .cmd or .bat)

 

I also found a nice explaination of the IIS-Setup here: http://learn.iis.net/page.aspx/130/understanding-setup-in-iis-7/  

 

Andreas Wolter Training & Consulting

SQL Server Suite Trainings

 

Europäische PASS Konferenz 2009 zu SQL Server vom 22.-24. April in Neuss

Über 20 Sprecher in 36 technischen Sessions in 2 Tagen (Hauptkonferenz) zu Business Intelligence, Datanbankentwicklung und -Administration mit Fokus auf SQL Server 2008.

Meine Empfehlung außerdem: die Preconference (1 Tag) "SQL Server 2008 Engine Performance and Advanced Diagnostics" mit Bob Ward vom Microsoft PSS Team

Eine super Gelegenheit mit den Größen der Branche in Kontakt zu kommen.


See you in Neuss -> zur website mit weiteren Informationen

European PASS Conference 2009

Andreas Wolter Training & Consulting

SQL Server Suite Trainings

Reporting Services 2005 x64 Fehlermeldungen bei der Installation unter Windows Server - mit Lösungen

bei der Einrichtung von Reporting Services 2005 Version x64 traten in der Reihenfolge folgende Fehler auf, zu welchen ich die Lösungen hier gerne hinterlegen möchte:

1)

"The virtual directory could not be created. The previously set virtual directory will still be used."

Details: "System.IO.FileNotFoundException:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
at ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.CreateVirtualDirectory(String virtualDirectory, String path)"

 

Lösung:

das lag daran, das  ASP.Net VOR dem .Net Framework 2.0 installiert war

(meine Quelle: http://www.bokebb.com/dev/english/2027/posts/2027133704.shtml )

Nach einer Reparatur-Installation des .Net Framework 2.0 lief es tadellos.

 

 2)

Als nächstes kam folgende Fehlermeldung auf der Website http://Servername/Reports:

"The ReportServerVirtualDirectory element is missing"

Lösung:

in der Datei RSWebApplication.config im Verzeichnis "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager"

im Knoten <ReportServerVirtualDirectory></ReportServerVirtualDirectory> den Servernamen wie folgt eintragen:

<ReportServerUrl>http://ServerName/Reportserver</ReportServerUrl>

 

3)

 Es folgte ein HTTP: 500 Fehler "The request failed with HTTP status 503: Service Unavailable."

 Lösung:

 iisreset in der Kommandozeile

 

so, ich hoffe das hilft dem Nächsten, etwas Zeit zu sparen

 

Andreas Wolter Training & Consulting

SQL Server Suite Trainings

Reporting Services CatalogItem.Type Property

Da ich keinen sinnfreien Testeintrag hier sehen will, starte ich den blog mit einer simplen Erkenntnis der letzten Zeit:

Wenn man unter Reporting Services 2005 die CatalogItem.Type Property ausliest um anhand des Typs herauszufinden, ob man beim Durchforsten eines Verzeichnisses via Script gerade einen Folder oder einen Report vor sich hat, führt einen die Onlinehilfe leider etwas in die Irre.

Dort steht an Position 5 "Model" - insofern man sich die hinterlegte Reihenfolge nummeriert und bei 0 beginnend denkt - der Rest passt dann auch. (BOL: ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.de/rswsref9/html/5dd84886-9d10-491e-be89-2f3be2ad03fc.htm )

Tatsächlich aber steht der Typ 5 für "DataSource"

hier die vollständige Übersicht:

CatalogItem.Type:

 0 - Unknown
 1 - Folder
 2 - Report
 3 - Resource
 4 - Linked Report
 5 - DataSource
 6 - Model

 - for your convenience ;-)

 

Andreas Wolter Training & Consulting

SQL Server Suite Trainings