Blog Home  Home RSS 2.0 Atom 1.0 CDF  
some thoughts... - MS SQL Server|RDBMS
IT makes the world go round - and sometimes stops it...
 
 Thursday, October 25, 2007

Rodney Landrum demonstrates an ingenious way to monitor blocked SQL Server processes across all your servers, using nothing but SSRS in his posting "The Reporting Services 3-Trick Pony"

Thursday, October 25, 2007 4:44:27 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Monday, September 24, 2007

If you would like to split values from a column which are divideable beacause they are using the same delimiter like an ',' for example you could use the function below. The function also brings up the postion, which sometimes could be very usefull, too.

To call the function just use,

select * from dbo.fn_split('Value 1,Value 2',',')

the first parameter is the column to split, the second contains the delimiter. You can not use different delimiters at one time at the moment, if you want to suggest some enhancements, please use the comments.... :-)
The statement will bring up the following result set:

CREATE FUNCTION [dbo].[fn_Split](@text nvarchar(max), @delimiter char(1) = ' ') 

RETURNS @Strings TABLE 
( 
position int IDENTITY PRIMARY KEY, 
value nvarchar(max) 
) 

AS 
BEGIN 

    DECLARE @index int 
    SET @index = -1 

    WHILE (LEN(@text) > 0) 
    BEGIN 
        SET @index = CHARINDEX(@delimiter , @text) 
        IF (@index = 0) AND (LEN(@text) > 0) 
        BEGIN 
            INSERT INTO @Strings VALUES (@text) 
            BREAK 
        END 
        IF (@index > 1) 
        BEGIN 
            INSERT INTO @Strings VALUES (LEFT(@text, @index - 1)) 
            SET @text = RIGHT(@text, (LEN(@text) - @index)) 
        END 
        ELSE 
            SET @text = RIGHT(@text, (LEN(@text) - @index)) 
    END 
    RETURN 
END
Monday, September 24, 2007 7:38:48 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 

Are you also always looking in the BOL if you have to deal with datetime?

This stored procedure could bring some light in the dark...

You will have to call it with the following statement:

Select dbo.fn_formatdate(getdate(),'formated date: \TT\MM\YYYY \hh:\mi:\ss \ms Week: \wk Weekday: \DW Quarter: \qq'),getdate()

The formatstring can contain severall formatstrings and will bring up all datetimeparts you want, including some additional textparts...

 

CREATE  FUNCTION [dbo].[fn_formatdate](@dat datetime,@format varchar(255)) 
RETURNS varchar(255) 
AS 
BEGIN 
    declare @ret varchar(255) 
    declare @i int 
    -- year 4 digits
    set @ret=replace(@format,'\jjjj',cast(year(@dat) as varchar(4)))
    -- year 4 digits 
    set @ret=replace(@ret,'\yyyy',cast(year(@dat) as varchar(4)))
    -- day 2 digits 
    set @ret=replace(@ret,'\dd',right('0'+cast(day(@dat) as varchar(2)),2))
    -- weekday 1 digit 
    set @ret=replace(@ret,'\dw',cast(datepart(dw,@dat) as varchar(1)))
    -- day of year
    set @ret=replace(@ret,'\dy',right('00'+cast(day(@dat) as varchar(3)),3))
    -- hour 2 digits
    set @ret=replace(@ret,'\hh',right('0'+cast(datepart(hh,@dat) as varchar(2)),2))
    -- year 2 digits 
    set @ret=replace(@ret,'\jj',right(cast(year(@dat) as varchar(4)),2))
    -- minute 2 digits 
    set @ret=replace(@ret,'\mi',right('0'+cast(datepart(mi,@dat) as varchar(2)),2))
    -- month 2 digits
    set @ret=replace(@ret,'\mm',right('0'+cast(month(@dat) as varchar(2)),2))
    -- milliseconds 3 digits
    set @ret=replace(@ret,'\ms',right('00'+cast(datepart(ss,@dat) as varchar(3)),3))
    -- quarter 2 digits 
    set @ret=replace(@ret,'\qq',right('0'+cast(datepart(qq,@dat) as varchar(2)),2))
    -- seconds 2 digits
    set @ret=replace(@ret,'\ss',right('0'+cast(datepart(ss,@dat) as varchar(2)),2)) 
    -- day 2 digits
    set @ret=replace(@ret,'\tt',right('0'+cast(day(@dat) as varchar(2)),2)) 
    -- week 2 digits
    set @ret=replace(@ret,'\wk',right('0'+cast(datepart(wk,@dat) as varchar(2)),2)) 
    -- year 2 digits
    set @ret=replace(@ret,'\yy',right(cast(year(@dat) as varchar(4)),2))
    -- day 1-2 digits 
    set @ret=replace(@ret,'\d',cast(day(@dat) as varchar(2)))
    -- hour 1-2 digits 
    set @ret=replace(@ret,'\h',cast(datepart(hh,@dat) as varchar(2)))
    -- month 1-2 digits 
    set @ret=replace(@ret,'\m',cast(month(@dat) as varchar(2)))
    -- minute 2 digits
    set @ret=replace(@ret,'\n',right('0'+cast(datepart(mi,@dat) as varchar(2)),2)) 
    -- quarter 1 digit 
    set @ret=replace(@ret,'\q',cast(datepart(qq,@dat) as varchar(1)))
    -- seconds 1-2 digits
    set @ret=replace(@ret,'\s',cast(datepart(ss,@dat) as varchar(2)))
    -- day 1-2 digits 
    set @ret=replace(@ret,'\t',cast(day(@dat) as varchar(2)))
    -- week 1-2 digits 
    set @ret=replace(@ret,'\w',cast(datepart(wk,@dat) as varchar(2)))

    return @ret 
END 
GO
Monday, September 24, 2007 5:33:12 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 

Do you want to create database snapshots? And do you want to do it programmatically? Then you could use this stored procedure...

Enjoy!

CREATE PROC [dbo].[spr_CreateSnapshot]
    (@Masterdb VARCHAR(255), @SnapshotName VARCHAR(255), @Execute BIT = 1) 
AS 
    SET NOCOUNT ON 
    DECLARE @NewLine CHAR(2) 
    DECLARE @Q CHAR(1) 
    DECLARE @fname VARCHAR(255) 
    DECLARE @extention VARCHAR(255) 
    DECLARE @Pfad VARCHAR(255) 
    DECLARE @DBname VARCHAR(255) 
    DECLARE @LogicName VARCHAR(255) 
    DECLARE @Command VARCHAR(MAX) 
    DECLARE @indexExt INT 
    DECLARE @indexPfad INT 
    DECLARE @lenFname INT 
    DECLARE @lenPfad INT 
    DECLARE @lenDB INT 
    DECLARE @lenExt INT 

    CREATE TABLE #Info
        (physical_name VARCHAR(255) not null, 
        logicname VARCHAR(255) not null) 

    SET @newLine = CHAR(13) + CHAR(10) 
    SET @Q = CHAR(39) 

    SET @command = 'INSERT INTO #info (physical_name, logicname) 
        SELECT s.physical_name,s.[name] AS LogicName 
        FROM '
            + Quotename(@masterdb) + '.sys.filegroups as g 
        INNER JOIN
        sys.master_files AS s ON 
            s.type = 0 
            AND s.database_id = db_id(' + @Q + @Masterdb + @Q + ') 
            AND s.drop_lsn is null 
            AND s.data_space_id = g.data_space_id 
        ORDER BY
            g.data_space_id' 
    EXECUTE (@Command) 

    SET @Command = 'CREATE DATABASE ' + @SnapshotName + @NewLine 
    SET @Command = @Command + 'ON' + @NewLine 

    DECLARE c CURSOR 
    READ_ONLY 
    FOR SELECT physical_name, logicname FROM #info 

    OPEN c 
    FETCH NEXT FROM c INTO @fname,@LogicName 
        WHILE (@@fetch_status <> -1) 
        BEGIN 
            IF (@@fetch_status <> -2) 
            BEGIN 
                SET @fname = REVERSE(@fname) 
                SET @lenFname = LEN(@fname) 
                SET @indexExt = CHARINDEX('.',@fname) -1 
                SET @indexPfad = CHARINDEX('\',@fname) - 1 
                SET @extention = REVERSE(SUBSTRING (@fname, 1, @indexExt)) 
                SET @lenExt = LEN(@extention) 
                SET @Pfad = LEFT (REVERSE(@fname), @lenFname - @indexPfad) 
                SET        @lenPfad = LEN(@Pfad) 
                SET @DBname = SUBSTRING(REVERSE(@fname), @lenPfad + 1, (@lenFname - @lenPfad - @lenExt) - 1) 
                SET @Command = @Command + '(Name = ' + @Q + @LogicName + @Q + ', Filename = ' + @Q 
                SET @Command = @Command + @Pfad + @SnapshotName + '_' + @DBname + '.' + 'ssh' + @Q + '),' + @NewLine 
            END 
        FETCH NEXT FROM c INTO @fname,@LogicName 
        END 
    CLOSE c 
    DEALLOCATE c 
    SET @Command = LEFT(@Command,LEN(@Command)-3) + @NewLine + 'AS SNAPSHOT OF ' + @masterdb 
        
    IF @Execute = 1 
    BEGIN 
        EXEC (@Command) 
    END 
    ELSE 
    BEGIN 
        SELECT @Command AS Command 
    END
Monday, September 24, 2007 5:14:49 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 

You are interested in getting some informations about your SQL Server, for example to be able to do an auditing on your SQL Server via SSIS, this code will help:

SELECT
    SERVERPROPERTY ('MachineName') as MachineName,
    SERVERPROPERTY ('InstanceName') as InstanceName,
    SERVERPROPERTY ('ProductVersion') as ProductVersion,
    SERVERPROPERTY ('ProductLevel') As ProductLevel,
    SERVERPROPERTY ('Edition') as Edition,
    SERVERPROPERTY ('LicenseType') as LicenseType,
    SERVERPROPERTY ('NumLicenses') as  NumLicenses,
    SERVERPROPERTY ('IsClustered') as IsClustered,
    SERVERPROPERTY ('IsIntegratedSecurityOnly') as IsIntegratedSecurityOnly
Monday, September 24, 2007 4:57:03 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 

I do not know the original author of this stored procedure...
If you are the one - please send me an email and I will publish the right credits!

After changing the structure of a table or delete one you will need to check and refresh your views also. This code will help...

DECLARE @Table_Name varchar(100)

DECLARE Refresh_Views CURSOR FOR
SELECT Table_Name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'VIEW' AND TABLE_SCHEMA = 'dbo'
OPEN Refresh_Views

FETCH NEXT FROM Refresh_Views INTO @Table_Name
WHILE @@FETCH_STATUS = 0
BEGIN
    EXEC sp_refreshview @Table_Name
    FETCH NEXT FROM Refresh_Views INTO @Table_Name
END

CLOSE Refresh_Views
DEALLOCATE Refresh_Views

Monday, September 24, 2007 4:51:39 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Wednesday, June 20, 2007

PASS Germany is doing a BootCamp again this year!

[Even if it is an event in German language I am writing in English - please spread this news around in your blogs though interested community members have the chance to participate]

We are slightly breaking traditions this year, because we are not having a complete BI-focused BootCamp, we are having two different tracks this time:

  • the first one is DBA-stuff including performance optimization, clustering, mirroring, security, etc
  • the second one is a deep dive into SQL Server Reporting Services including development, design, security, infrastructur and 3rd party tools like Dundas also

With one habit we do not break traditions! We have included three suprising night sessions again and also two late night sessions - stay tuned!

For further information visit the event page - if you want to register, please use this link.

The Early-Bird ends at 9th July 2007 and the seats are limited - so register as fast as possible...

Wednesday, June 20, 2007 10:29:37 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |   | 
 Thursday, May 10, 2007

Today at the BI Conference in Seattle Jeff Raikes from Microsoft has given a first official impact - just slides - on the next SQL Server version.

I have seen a new feature called Change Data Capture (also mentioned in the datasheet) in the session "PL208 Data Warehousing with Microsoft SQL Server 2005" presented by Gopal Ashok, Program Manager with the SQL Server Product team, which was quite impressive.

Ever dealt with the problem of having mass data in a table and no "real" marker to identify the specific rows for incremental data operations like inserts, updates and deletes?
The Change Data Capture should ease your pain by creating a kind of audit table to watch data modification without the need of programming stored procedures, triggers and so on.
I am extremely curious how this feature proves in real life scenarios. And I am also a little bit surprised if the SSIS team will not bring up some new tasks to enable the use of the audit table of the Change Data Capture - or do we still need to develop the handling concerning load cycles, deleting of successfully loaded records, etc by our own? A kind of automatic delta queue mechanism and handling like in SAP systems would be great!

Tomorrow Ted Kummert, corporate vice president of the Data and Storage Platform Division at Microsoft will have a keynote at the morning - I hope that he will show some more live impressions.

You will find the official press release here.

And there also is a information website online.

Regarding to the press release, "SQL Server “Katmai” is scheduled to be delivered in 2008" - but there is no information about CTP´s available on the website yet.

Thursday, May 10, 2007 3:03:05 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 
 Tuesday, May 01, 2007

Vera Noest provides a really great link collection of ressources which will be very usefull while doing troubleshoting.

Vera also provides troubleshooting tips for Terminal Server and Citrix.

Worth reading - check it out!

Tuesday, May 01, 2007 11:34:30 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 

Darren Gosbell has posted a very interesting article about querying SSAS and use the result in the relational part of SQL Server.

I have used it in a project to retransfer data which was calculated due to a parent child dimension containing items for a financial analysis.
Calculating this via the relational data would have been a mess, because of having to rebuild the whole calculation from the bottom to the top of the hierarchy.

All you have to do is to define a linked server in the first step:

USE master 
GO 

/* Add new linked server */ 
EXEC sp_addlinkedserver 
@server='LINKED_OLAP', -- local SQL name given to the linked server 
@srvproduct='', -- not used 
@provider='MSOLAP.3', -- OLE DB provider (the .2 means the SQL2K version) 
@datasrc='localhost', -- analysis server name (machine name) 
@catalog='Adventure Works DW' -- default catalog/database

After successfully defining the linked server you will be able to query any SSAS cube based on your security like this way:

SELECT * 
FROM OpenQuery(linked_olap,'SELECT --measures.members 
  {Measures.[Internet Sales Amount]} ON COLUMNS, 
  [Date].[Month].members ON ROWS 
FROM [Adventure Works]') 

While writing this blog entry I tested it on my notebook also - and was very astonished that querying the cube does not work, while testing the linked server worked well.
I am getting an error message like:
"Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "MSOLAP.3" for linked server "linked_olap" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "MSOLAP.3" for linked server "linked_olap"."

Maybe it depends on Windows Vista, even with the security set in the right way and also running SSMS as an administrator...

Tuesday, May 01, 2007 11:05:16 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [3]   |  |  |   | 

Narayana Vyas Kondreddi has published some nice little sql helpers to search and replace data in various tables - therefor the following content is intellectual property of Narayana Vyas Kondreddi.

Maybe you will have to adjust the sql commands to search only special tables via a prefix for example or to just search via a special column...


The first one, SearchAllTables, can search all the columns of all the tables in a given database for a specific keyword:

CREATE PROC SearchAllTables
(
@SearchStr nvarchar(100)
)
AS
BEGIN

-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Tested on: SQL Server 7.0 and SQL Server 2000
-- Date modified: 28th July 2002 22:50 GMT


CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')

WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ''
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
AND OBJECTPROPERTY(
OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
), 'IsMSShipped'
) = 0
)

WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
BEGIN
SET @ColumnName =
(
SELECT MIN(QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
AND QUOTENAME(COLUMN_NAME) > @ColumnName
)

IF @ColumnName IS NOT NULL
BEGIN
INSERT INTO #Results
EXEC
(
'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)
FROM '
+ @TableName + ' (NOLOCK) ' +
' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
)
END
END
END

SELECT ColumnName, ColumnValue FROM #Results
END


The second one, SearchAndReplace, does not only perform the search but also will do a replace:

CREATE PROC SearchAndReplace
(
@SearchStr nvarchar(100),
@ReplaceStr nvarchar(100)
)
AS
BEGIN

-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string and replace it with another string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Tested on: SQL Server 7.0 and SQL Server 2000
-- Date modified: 2nd November 2002 13:50 GMT

SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110), @SQL nvarchar(4000), @RCTR int
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
SET @RCTR = 0

WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ''
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
AND OBJECTPROPERTY(
OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
), 'IsMSShipped'
) = 0
)

WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
BEGIN
SET @ColumnName =
(
SELECT MIN(QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
AND QUOTENAME(COLUMN_NAME) > @ColumnName
)

IF @ColumnName IS NOT NULL
BEGIN
SET @SQL= 'UPDATE ' + @TableName +
' SET ' + @ColumnName
+ ' = REPLACE(' + @ColumnName + ', '
+ QUOTENAME(@SearchStr, '''') + ', ' + QUOTENAME(@ReplaceStr, '''') +
') WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
EXEC (@SQL)
SET @RCTR = @RCTR + @@ROWCOUNT
END
END
END

SELECT 'Replaced ' + CAST(@RCTR AS varchar) + ' occurence(s)' AS 'Outcome'
END

Tuesday, May 01, 2007 8:37:56 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 
 Tuesday, April 24, 2007

To get all base tables of a view you can use the following CTE-Statement:

WITH CTE (VIEW_SCHEMA,VIEW_NAME,TABLE_SCHEMA,TABLE_NAME)
AS
(
SELECT VIEW_SCHEMA,VIEW_NAME,TABLE_SCHEMA,TABLE_NAME
FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
)
SELECT vu.VIEW_SCHEMA,
         vu.VIEW_NAME,
         vu.TABLE_SCHEMA    AS src_schema,
         vu.TABLE_NAME        AS src_table
FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE VU LEFT JOIN CTE
     ON VU.TABLE_SCHEMA    =CTE.VIEW_SCHEMA
         AND VU.TABLE_NAME=CTE.VIEW_name

 

Tuesday, April 24, 2007 1:20:16 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Klaus Hoeltgen   Comments [0]   |  |  |   | 
 Tuesday, February 20, 2007

Interested in all the new things in SP2? Here is a complete list.

And this is the complete download site with links for the SP2 itself, a new BOL, new Samples, new Feature Pack and especially the links to SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies and SQL Server 2005 Data Mining Add-ins for Microsoft Office 2007.

To avoid a restart after the installation of the SP2 you should stop the neccessary services which could be done with the following commands on the command line - if you have used the standard instances:

net stop MSSQLSERVER
net stop MSSQLServerOLAPService
net stop msftesql
net stop MsDtsServer
net stop ReportServer

After the installation the "SQL Server 2005 User Provisioning Tool is started automatically if you use Windows Vista. As you probably know, Windows Admins are not automatically also SQL or AS Admins  - this tool enables to set the right privileges to the administartor accounts.

But do not forget to start the services before you try to set the privileges...

If you want to add a new account you will have to start the Provisioning Tool again, but unluckily it is not added to the Start Menu, you will find it at:
C:\Program Files\Microsoft SQL Server\90\Shared\SqlProv.exe - assumed that you have a standard installation and an english version of MS Windows Vista.

Tuesday, February 20, 2007 2:17:05 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 
 Thursday, February 15, 2007

Interested in online ressources for SQL Server Training?
Please do not forget that these ressources can not replace a complete Training and therefor only should be considered as a additional point of information...

Subject

Title

Level

Link

Design

2794: Designing a Business Intelligence Solution Architecture for the Enterprise Using Microsoft SQL Server 2005

ILT

Design

2795: Designing an ETL Solution Architecture using Microsoft SQL Server 2005 Integration Services

ILT

Design

2796: Designing a Multi Dimensional Solution Architecture Using Microsoft SQL Server 2005 Analysis Services

ILT

Design

2797: Designing a Reporting Solution Architecture using Microsoft SQL Server 2005 Reporting Services

ILT

Design

New Features of Microsoft SQL Server 2005 Analysis Services: Course 2942

eLearning

Design

Updating your Data ETL Skills to Microsoft SQL Server 2005 Integration Services: Course 2943

eLearning

Design

Updating your Reporting Skills to Microsoft SQL Server 2005 Reporing Services: Course 2944

eLearning

Design

Introduction to Microsoft SQL Server 2005 Reporting Services

200

eLearning

Design

Introduction to SQL Server 2005 Analysis Services

200

eLearning

Design

Introduction to SQL Server 2005 Reporting Services (Part 1 of 6)

200

eLearning

Design

Introduction to SQL Server 2005 Reporting Services (Part 2 of 6)

Design

Introduction to SQL Server 2005 Reporting Services (Part 3 of 6)

Design

Introduction to SQL Server 2005 Reporting Services (Part 4 of 6)

Design

Introduction to SQL Server 2005 Reporting Services (Part 5 of 6)

Design

Introduction to SQL Server 2005 Reporting Services (Part 6 of 6)

Design

SQL Server 2005 Analysis Services: Preparing to Migrate

200

Webcast

Design

SQL Server 2005 for the IT Professional (Part 6 of 11): New Application Design Patterns for Scalability and Availability and the Operational Implications of Service Broker (Level 200)

200

Webcast

Design

SQL Server 2005 for the IT Professional (Part 11 of 11): Best Practices in Building Robust, Recoverable, and Reliable Systems

200

Webcast

Design

Scripting in Microsoft SQL Server 2005

300

Webcast

Design

Selling & Implementing Microsoft DW / BI using the Kimball Method

200

Webcast

Design

Designing a Scalable Data Warehouse / Business Intelligence (DW/BI) System (Level 200)

Webcast

Design

Using SQL Server 2005 Integration Services to Populate a Kimball Method Data Warehouse (Level 200)

Webcast

Develop

Creating the Data Access Tier Using Micrsoft SQL Server 2005: Course 2941

eLearning

Develop

Using SQL Server 2005 Integration Services to Populate a Kimball Method Data Warehouse

200

eLearning

Develop

Applying SQL Server 2005 Data Mining to Enterprise Business Problems

300

eLearning

Develop

Building Business Intelligence Application with ADOMD.NET

300

eLearning

Develop

Creating a Custom Security Solution for SQL Server 2005 Reporting Services

200

eLearning

Develop

Extending SQL Server Integration Services with Custom Components

300

eLearning

Develop

Incorporating Data Mining into the Integration, Analysis and Reporting Components of Business Intelligence

300

eLearning

Develop

Integrating Hand-coded ETL with SQL Server Integration Services

300

eLearning

Develop

Integrating Windows Sharepoint Services with SQL Server Reporting Services

200

eLearning

Develop

Intelligent Applications: Embedding Data Mining in Your Application

300

eLearning

Develop

Efficiently Using the SQL Server Execution Context in Applications

200

Webcast

Develop

SQL Server 2005: Drill-Down for Technical Pre-Sales - Data Warehousing

300

eLearning

Develop

Designing SQL Server 2005 Data Warehouses with a Database Engine Focus

300

eLearning

Manage

Troubleshooting SQL Server 2005 Integration Services (Level 300)

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 1 of 11): A Fast-Paced Feature Overview and Series Introduction

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 2 of 11): Security

300

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 3 of 11): Understanding Installation Options and Initial Configuration

200

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 5 of 11): Effective Use of the New Management Tools

200

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 7 of 11): Technologies and Features to Improve Availability

200

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 8 of 11): Implementing Database Mirroring in SQL Server 2005 (Part 1 of 2)

200

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 9 of 11): Implementing Database Mirroring in SQL Server 2005 (Part 2 of 2)

200

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 10 of 11): Recovering from Human Error

200

Webcast

Manage

Technical Benefits of SQL Server 2005 for Every Business

200

Webcast

Manage

Choosing the SQL Server 2005 Edition That Best Fits Your Needs

200

Webcast

Manage

SQL Server 2005 Series (Part 1 of 10): Administration Tools

200

Webcast

Manage

SQL Server 2005 Series (Part 2 of 10): Monitoring Tools

200

Webcast

Manage

SQL Server 2005 Series (Part 3 of 10): Achieving Greater Concurrency

200

Webcast

Manage

SQL Server 2005 Series (Part 4 of 10): Securing Your SQL Server

200

Webcast

Manage

SQL Server 2005 Series (Part 5 of 10): Protecting Sensitive Data

200

Webcast

Manage

SQL Server 2005 Series (Part 6 of 10): Managing Large Databases Using Partitioning

200

Webcast

Manage

SQL Server 2005 Series (Part 7 of 10): Indexing Enhancements

200

Webcast

Manage

SQL Server 2005 Series (Part 8 of 10) Data Recovery

200

Webcast

Manage

SQL Server 2005 Series (Part 9 of 10): High Availability

200

Webcast

Manage

SQL Server 2005 Series (Part 10 of 10): Moving Data Between Data Sources

200

Webcast

Manage

SQL Server 2005 for CRM

200

Webcast

Manage

SQL Server 2005 for Financial Services

200

Webcast

Manage

SQL Server 2005 Express Edition

200

Webcast

Manage

Data Quality and Compliance with SQL Server 2005 Integration Services

200

Webcast

Manage

Heterogeneous Data Integration Using SQL Server 2005 Integration Services

300

Webcast

Manage

Integrating Non-Standard Data Sources and Adding Value to Data with SQL Server 2005 Integration Services

200

Webcast

Manage

Setting Up and Deploying SQL Server 2005 Reporting Services for SAP BW

200

Webcast

Manage

Accessing Operational Data in Mainframe VSAM Using SQL Server 2005 and Host Integration Server

200

Webcast

Manage

Get More from Your Oracle Data with SQL Server 2005

300

Webcast

Manage

How Microsoft IT Runs SAP on SQL Server 2005

300

Webcast

Manage

Integrating Existing Information in IBM DB2 using SQL Server 2005 and Host Integration Server

200

Webcast

Manage

Replicating Data Between Oracle and SQL Server 2005

200

Webcast

Manage

Setting Up and Configuring SQL Server 2005 for SAP Applications

300

Webcast

Manage

Real-Time Business Intelligence with SQL Server 2005 Analysis Services

300

Webcast

Manage

SQL Agent in SQL Server 2005

300

Webcast

Manage

SQL Server 2005 Integration Services: Performance and Scale

400

Webcast

Manage

SQL Server 2005 Makes Extensive Use of Tempdb

200

Webcast

Manage

SQL Server 2005 Manageability Using Management Pack for MOM

200

Webcast

Manage

SQL Server 2005 Reporting Services Management and Security

300

Webcast

Manage

Understanding Maintenance and Monitoring Enhancements to SQL Server 2005

200

Webcast

Manage

Virtualize SQL Server 2005 on Virtual Server 2005 R2

200

Webcast

Manage

Encryption and Key Management Using SQL Server 2005

200

Webcast

Manage

How Microsoft IT Implements Encryption Using SQL Server 2005

300

Webcast

Manage

Introduction to Security in SQL Server 2005

300

Webcast

Manage

Securing Business Solutions Based on SQL Server 2005

200

Webcast

Manage

SQL Server 2005 for the IT Professional (Part 2 of 11): Security

200

Webcast

Manage

SQL Server 2005 Security

200

Webcast

Manage

SQL Server 2005 Security Enhancements

200

Webcast

Manage

SQL Server 2005 Security Overview 

200

Webcast

Manage

SQL Server 2005 Surface Area Configuration

200

Webcast

Manage

Best Practices for Deploying SQL Server 2005 on Storage Area Networks

300

Webcast

Manage

Optimize Your SQL Server Environment for Availability with Storage Foundation for Windows

200

Webcast

Manage

SQL Server 2005 Makes Extensive Use of Tempdb

200

Webcast

Manage

What's New in the Database Storage Engine in SQL Server 2005

300

Webcast

Manage

SQL Server DBA’s Guide to CLR Integration

300

Webcast

Manage

Performance Diagnosis in SQL Server 2005

300

Webcast

Manage

SQL Server 2005 Database Tuning Advisor

300

Webcast

Manage

SQL Server 2005 Troubleshooting: Supportability Features for SQL 2005

300

Webcast

Manage

Troubleshooting Performance Problems in Microsoft SQL Server 2005

200

Webcast

Manage

Troubleshooting SQL Server 2005 Integration Services

300

Webcast

Manage

Enabling Ad-hoc Reporting with SQL Server 2005 Reporting Services

200

TechNet

Thursday, February 15, 2007 3:41:58 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 
 Thursday, November 16, 2006
SQL Server 2005

After offering free delta courses Microsoft now offers a whole bunch of free E-Learning courses, which will enable you to pass the Exam 70-445 for the Microsoft Certified Technology Specialist (MCTS) SQL Server 2005 Business Intelligence.

You will find the complete Course Catalog at www.microsoftelearning.com

There are also some other resources for free at the moment at a subsite from Microsoft SQL Server 2005 – Learning Portal they called Dig Deep. Especially the free e-book Microsoft SQL Server 2005 Administrator's Pocket Consultant is a very useful resource and worth reading.

Sharepoint Technology

There is another bunch of free E-Learning courses for the Sharepoint Technology, which can be found here.

Visual Studio 2005 and .Net 3.0

And as expected developers are not left alone and there are also free E-Learning courses and a Dig Deep available for Visual Studio 2005 and .Net 3.0.

Thursday, November 16, 2006 6:33:53 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |  |   | 
 Wednesday, November 08, 2006

Sorry, German only...

PASS Deutschland e.V. bietet wieder eine interesssante Veranstaltung an und wir starten damit eine neue Reihe, die PASS Essentials. Ziel dieser Veranstaltung ist die Grundlagenvermittlung in einem spezifischen Thema des SQL Server 2005 innerhalb eines Tages mit einer begrenzten Anzahl an Teilnehmern und mit einen hohen Anteil Hands-On-Labs.

Los geht es mit dem "DBA StartUp", einem eintägigen Überblick über Installation,Backup & Restore, der am 23.November 2006 von 09.00 - 18.00 Uhr bei Microsoft in Bad Homburg stattfindet

Speaker ist mein hochgeschätzter PASS-Vorstandskollege Ralf Dietrich:
"Ralf Dietrich ist seit 1998 als Trainer und Consultant für Microsoft Betriebssysteme
und Datenbanken tätig. Als MCT, MCSE (Security) und MCITP für SQL Server
liegt sein Fokus in der Performanceanalyse und im Data Warehouse Design. Mit
Microsoft SQL Server 2005 beschäftigt er sich seit Mitte Juli 2003. Ihm liegen
sichere Servernetze & SQL-Server Installationen besonders am Herzen."

Hier der entsprechende Flyer PASSEssentials_DBAStartup.pdf (40.42 KB) mit mehr Informationen.

Wednesday, November 08, 2006 4:28:52 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Wednesday, October 25, 2006

You will find a complete overview for the System Views at http://msdn2.microsoft.com/en-us/library/ms177862.aspx.

The most usefull ones of the Catalog Views probably will be

To query metadata you will have to use the Information Schema Views.

If you need some hints on how to use the SQL Server System Catalog have a look at Querying the SQL Server System Catalog and the Querying the SQL Server System Catalog FAQ for some examples.

Wednesday, October 25, 2006 11:00:30 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Sunday, August 27, 2006

Brett Kaiser has posted a article called "How do I track data changes in a database" including his real usefull coding about his idea of doing this via T-SQL automatically every time a DELETE or UPDATE Modification will be executed.

The following content is intellectual property of Brett Kaiser, the original posting can be found here:

USE Northwind
SET NOCOUNT ON
GO

-- For example purposes, create a sample tables
CREATE TABLE myTable99(Col1 int IDENTITY(1,1), Col2 char(1), Col3 datetime DEFAULT(GetDate()), Col4 decimal(5,2))
CREATE TABLE x002548.myTable99(Col1 int IDENTITY(1,1), Col2 char(1), Col3 datetime DEFAULT(GetDate()), Col4 decimal(5,2))
GO

-- Give the sample tables some data
INSERT INTO myTable99(Col2, Col4)
SELECT 'x', 1 UNION ALL SELECT 'y', 2 UNION ALL SELECT 'z', 3
INSERT INTO x002548.myTable99(Col2, Col4)
SELECT 'a', 24 UNION ALL SELECT 'b', 25 UNION ALL SELECT 'c', 26

--Lets have a look
SELECT 'x002548' AS Source, * FROM x002548.myTable99
UNION ALL
SELECT 'dbo' AS Source, * FROM myTable99
GO

-- CREATE A Driver Table for all Tables in your catalog you wish to audit
CREATE TABLE myAudit99(TABLE_CATALOG sysname, TABLE_SCHEMA sysname, TABLE_NAME sysname)
GO

-- Populate the audit driver table with the table you want...you can use any type of process for this
INSERT INTO myAudit99(TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME)
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.Tables
WHERE TABLE_NAME LIKE 'myTable99%'

-- Lets create some audit tables based on the Driver

DECLARE myCursor99 CURSOR
FOR
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
FROM myAudit99

DECLARE @TABLE_CATALOG sysname, @TABLE_SCHEMA sysname, @TABLE_NAME sysname, @COLUMN_NAMES varchar(8000), @sql varchar(8000)
SELECT @COLUMN_NAMES = ''
OPEN myCursor99

FETCH NEXT FROM myCursor99 INTO @TABLE_CATALOG, @TABLE_SCHEMA, @TABLE_NAME

WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @SQL = 'CREATE TABLE ' + @TABLE_CATALOG + '.' + @TABLE_SCHEMA + '.' + @TABLE_NAME + '_H ('
+ ' HIST_ADD_DT datetime DEFAULT (getDate()), HIST_ADD_TYPE char(1) NOT NULL'
+ ', HIST_ADD_SYSTEM_USER sysname NOT NULL, HIST_ADD_USER_NAME sysname NOT NULL'
+ ', HIST_ADD_HOSTNAME sysname NOT NULL, HIST_ADD_SPID int NOT NULL, HIST_ADD_DESC varchar(50) '
, @COLUMN_NAMES = @COLUMN_NAMES + ', ' + COLUMN_NAME
+ ' ' + DATA_TYPE
+ CASE WHEN CHARACTER_MAXIMUM_LENGTH IS NOT NULL THEN '(' + CONVERT(varchar(20),CHARACTER_MAXIMUM_LENGTH) + ')'
WHEN DATA_TYPE = 'decimal' THEN '(' + CONVERT(varchar(20),NUMERIC_PRECISION) + ','
+ CONVERT(varchar(20),NUMERIC_SCALE) + ')'
ELSE ''
END
FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_CATALOG = @TABLE_CATALOG AND TABLE_SCHEMA = @TABLE_SCHEMA AND TABLE_NAME = @TABLE_NAME
ORDER BY ORDINAL_POSITION

SELECT @SQL = @SQL + @COLUMN_NAMES + ')'

EXEC(@SQL)

SELECT @SQL = '', @COLUMN_NAMES = ''

FETCH NEXT FROM myCursor99 INTO @TABLE_CATALOG, @TABLE_SCHEMA, @TABLE_NAME

END

CLOSE myCursor99
DEALLOCATE myCursor99
GO

SELECT *
FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME Like 'myTable99%'
ORDER BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION

-- Now Lets create the audit TRIGGERS

DECLARE myCursor99 CURSOR
FOR
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
FROM myAudit99

DECLARE @TABLE_CATALOG sysname, @TABLE_SCHEMA sysname, @TABLE_NAME sysname, @COLUMN_NAMES varchar(8000), @sql varchar(8000)
SELECT @COLUMN_NAMES = ''
OPEN myCursor99

FETCH NEXT FROM myCursor99 INTO @TABLE_CATALOG, @TABLE_SCHEMA, @TABLE_NAME

WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @COLUMN_NAMES = @COLUMN_NAMES + ', ' + COLUMN_NAME
FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_CATALOG = @TABLE_CATALOG AND TABLE_SCHEMA = @TABLE_SCHEMA AND TABLE_NAME = @TABLE_NAME
ORDER BY ORDINAL_POSITION

SELECT @SQL = 'CREATE TRIGGER ' + @TABLE_SCHEMA + '_' + @TABLE_NAME + '_TR ON ' + @TABLE_SCHEMA + '.' +@TABLE_NAME
+ ' FOR UPDATE, DELETE AS '
+ ' DECLARE @HOSTNAME sysname, @DESC varchar(50) '
+ ' SELECT @HOSTNAME = hostname from master.dbo.sysprocesses where spid = @@SPID '
+ ' IF EXISTS(SELECT * FROM ' + @TABLE_NAME + ') SELECT @DESC = '
+ '''' + '''' + ' ELSE SELECT @DESC = ' + '''' + 'MASS DELETE' + ''''
+ ' If Exists (Select * From Inserted) And Exists (Select * From Deleted) '
+ ' INSERT INTO ' + @TABLE_NAME + '_H ( '
+ ' HIST_ADD_TYPE, HIST_ADD_SYSTEM_USER, HIST_ADD_USER_NAME, HIST_ADD_HOSTNAME, HIST_ADD_SPID, HIST_ADD_DESC'
+ @COLUMN_NAMES + ')'
+ ' SELECT ''U'', SYSTEM_USER, USER_NAME(), @HOSTNAME, @@SPID, @DESC'
+ @COLUMN_NAMES + ' FROM deleted'
+ ' If Not Exists (Select * From Inserted) And Exists (Select * From Deleted) And @DESC = '''' '
+ ' INSERT INTO ' + @TABLE_NAME + '_H ( '
+ ' HIST_ADD_TYPE, HIST_ADD_SYSTEM_USER, HIST_ADD_USER_NAME, HIST_ADD_HOSTNAME, HIST_ADD_SPID, HIST_ADD_DESC'
+ @COLUMN_NAMES + ')'
+ ' SELECT ''D'', SYSTEM_USER, USER_NAME(), @HOSTNAME, @@SPID, @DESC'
+ @COLUMN_NAMES + ' FROM deleted'
+ ' If Not Exists (Select * From Inserted) And Exists (Select * From Deleted) And @DESC <> '''' '
+ ' INSERT INTO ' + @TABLE_NAME + '_H ( '
+ ' HIST_ADD_TYPE, HIST_ADD_SYSTEM_USER, HIST_ADD_USER_NAME, HIST_ADD_HOSTNAME, HIST_ADD_SPID, HIST_ADD_DESC'
+ @COLUMN_NAMES + ')'
+ ' SELECT TOP 1 ''D'', SYSTEM_USER, USER_NAME(), @HOSTNAME, @@SPID, @DESC'
+ @COLUMN_NAMES + ' FROM deleted'

EXEC(@SQL)

SELECT @SQL = '', @COLUMN_NAMES = ''

FETCH NEXT FROM myCursor99 INTO @TABLE_CATALOG, @TABLE_SCHEMA, @TABLE_NAME

END

CLOSE myCursor99
DEALLOCATE myCursor99
GO

-- Now let's pretend to be an ignorant boss...not to much of a stretch there....

UPDATE myTable99 SET Col2 = 'G'

SELECT * FROM myTable99_H

DELETE FROM myTable99 WHERE Col1 = 1

SELECT * FROM myTable99_H

DELETE FROM x002548.myTable99

SELECT * FROM x002548.myTable99_H

SELECT * FROM myTable99

SELECT * FROM x002548.myTable99
GO

SET NOCOUNT OFF
DROP TABLE myAudit99
DROP TRIGGER dbo_myTable99_TR
DROP TRIGGER x002548_myTable99_TR
DROP TABLE dbo.myTable99
DROP TABLE x002548.myTable99
DROP TABLE dbo.myTable99_H
DROP TABLE x002548.myTable99_H
GO

Sunday, August 27, 2006 3:09:14 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 
Nigel Rivett has published an interesting detailed article about common table expressions in SQL Server 2005 on simple-talk.com.
Sunday, August 27, 2006 2:39:40 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Friday, August 25, 2006

Definition from the SQL Server 2005 Product Guide:

"SQL Server Management Objects (SMO) is the management object model for SQL Server 2005. SMO represents significant design and architectural improvements for the SQL Server management object model. It is a simple to use but rich object model that is based on .NET Framework managed code. SMO is the primary tool for developing database management applications using the .NET Framework. SMO is used extensively by SQL Server Management Studio. Every administrative action that you can perform in SQL Server Management Studio, you can also accomplish by using SMO.
The new SMO object model and the WMI APIs replace SQL-DMO. Where possible, SMO incorporates similar objects as those in SQL-DMO for ease of use. You can still use SQL Server 2005 with SQL-DMO, but SQL-DMO will not be updated to manage features that are specific to SQL Server 2005.

Microsoft SQL Server 2005 Management Objects Collection from the Feature Pack for Microsoft SQL Server 2005 - April 2006

Database Engine Administration Programming

SQL Server Management Objects (SMO)

Programming Specific Tasks

Microsoft.SqlServer.Management.Smo.Agent Namespace

Job.Start Method

Job.CurrentRunStatus Property

Jasper Smith - Getting Started with SMO in SQL 2005

Darshan Singh - A Quick Introduction to SQL Server Management Objects (SMO)

Thomas Haller - SMO - Manage your SQL Server

Michiel Wories - SQL Server: SMO Scripting Basics

SMO enumerator in SQL Server Integration Services

Friday, August 25, 2006 2:55:09 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 

Randy Dyess has published an article called "Auditing Your SQL Server Environment: Part II (Reviewing Role Memberships)"

The following content is intellectual property of Randy Dyess, the original posting can be found here:

"Roles should be in foremost in your mind when planning the security of your SQL Server environments. Auditing inherited SQL Server installations is a relatively easy thing to accomplish, and all DBAs should audit their environment and create documentation if they have not already done so. Once you can document the logins assigned to each of your fixed and user-defined roles, you can start to remove any duplication of permissions which can reduce the time needed to troubleshoot future permission errors."

--Use the master database
USE master
go

IF OBJECT_ID('dbo.spRoleMembers') IS NOT NULL
DROP PROCEDURE dbo.spRoleMembers
GO

CREATE PROCEDURE dbo.spRoleMembers
AS
/************************************************************
Creation Date: 04/28/02 Created By: Randy Dyess
Web Site: www.TransactSQL.Com
Email: RandyDyess@TransactSQL.Com
Purpose: Loops through all databases and obtains member
for database roles as well as server role members.
Location: master database
Output Parameters: None
Return Status: None
Called By: None
Calls: None
Data Modifications: None
Updates:
None

************************************************************/

SET NOCOUNT ON

--Variables
DECLARE @lngCounter INTEGER
DECLARE @strDBName VARCHAR(50)
DECLARE @strSQL NVARCHAR(4000)

--Temp table to hold database and user-define role user names
CREATE TABLE #tRolemember
(
strServerName VARCHAR(50) DEFAULT @@SERVERNAME
,strDBName VARCHAR(50)
,strRoleName VARCHAR(50)
,strUserName VARCHAR(50)
,strUserID VARCHAR(100)
)

--Temp table to hold database names
CREATE TABLE #tDBNames
(lngID INTEGER IDENTITY(1,1)
,strDBName VARCHAR(50)
)

--Create permanent table
IF OBJECT_ID ('dbo.tRolemember') IS NULL
BEGIN
CREATE TABLE dbo.tRolemember
(
strServerName VARCHAR(50)
,strDBName VARCHAR(50)
,strRoleName VARCHAR(50)
,strUserName VARCHAR(50)
,strUserID VARCHAR(100)
)
END

--Obtain members of each server role
INSERT INTO #tRolemember (strRoleName, strUserName, strUserID)
EXEC dbo.sp_helpsrvrolemember

--Obtain database names
INSERT INTO #tDBNames (strDBName)
SELECT name FROM master.dbo.sysdatabases
SET @lngCounter = @@ROWCOUNT

--Loop through databases to obtain members of database roles and user-defined roles
WHILE @lngCounter > 0
BEGIN

--Get database name from temp table
SET @strDBName = (SELECT strDBName FROM #tDBNames WHERE lngID = @lngCounter)

--Obtain members of each database and user-defined role
SET @strSQL = 'INSERT INTO #tRolemember (strRoleName, strUserName, strUserID)
EXEC '
+ @strDBName + '.dbo.sp_helprolemember'

EXEC sp_executesql @strSQL

--Update database name in temp table
UPDATE #tRolemember
SET strDBName = @strDBName
WHERE strDBName IS NULL

SET @lngCounter = @lngCounter - 1

END

--Place data into permanent table
INSERT INTO tRolemember
SELECT trm.* FROM #tRolemember trm
LEFT JOIN tRoleMember prm
ON trm.strUserName = prm.strUserName
AND trm.strDBName = prm.strDBName
AND trm.strRoleName = prm.strRoleName
AND trm.strServerName = prm.strServerName
WHERE prm.strServerName IS NULL

GO

--Test Stored Procedure
EXEC dbo.spRoleMembers

PRINT 'Display by User'
SELECT strUserName, strDBName, strRoleName, strServerName FROM tRolemember
WHERE strUserName <> 'dbo'
ORDER BY strUserName

PRINT 'Display by Role'
SELECT strRoleName, strDBName, strUserName,strServerName FROM tRolemember
WHERE strUserName <> 'dbo'
ORDER BY strRoleName

PRINT 'Display by Database'
SELECT strDBName, strRoleName,strUserName, strServerName FROM tRolemember
WHERE strUserName <> 'dbo'
ORDER BY strDBName


Randy also has published a script about auditing user's passwords

The following content is intellectual property of Randy Dyess, the original posting can be found here:

IF OBJECT_ID('dbo.spAuditPasswords') IS NOT NULL
DROP PROCEDURE dbo.spAuditPasswords
GO

CREATE PROCEDURE dbo.spAuditPasswords
AS
/****************************************************************************
Creation Date: 03/22/02 Created By: Randy Dyess
Web Site: www.TransactSQL.Com
Email: RandyDyess@TransactSQL.Com
Purpose: Perform a simple audit of user's passwords
Location: master database
Output Parameters: None
Return Status: None
Called By: None
Calls: None
Data Modifications: None
Updates: None
Date Author Purpose
---------- -------------------------- ---------------------------------
****************************************************************************/

SET NOCOUNT ON

--Variables
DECLARE @lngCounter INTEGER
DECLARE @lngCounter1 INTEGER
DECLARE @lngLogCount INTEGER
DECLARE @strName VARCHAR(256)

--Create table to hold SQL logins
CREATE TABLE #tLogins
(
numID INTEGER IDENTITY(1,1)
,strLogin SYSNAME NULL
,lngPass INTEGER NULL
)

--Insert non ntuser into temp table
INSERT INTO #tLogins (strLogin)
SELECT name FROM master.dbo.syslogins WHERE isntname = 0
SET @lngLogCount = @@ROWCOUNT

--Determine if password is null and user iis SQL Login
PRINT 'The following logins have blank passwords'
SELECT name AS 'Login Name' FROM master.dbo.syslogins
WHERE password IS NULL
AND isntname = 0


--Determine if password and name are the ssame
SET @lngCounter = @lngLogCount

WHILE @lngCounter <> 0
BEGIN
    SET @strName = (SELECT strLogin FROM #tLogins WHERE numID = @lngCounter)

    UPDATE #tLogins
    SET lngPass = (SELECT PWDCOMPARE (@strName,(SELECT password FROM master.dbo.syslogins WHERE name = @strName)))
    WHERE numID = @lngCounter

    SET @lngCounter = @lngCounter - 1
END

PRINT 'The following logins have passwords the same as their login name'
SELECT strLogin AS 'Login Name' FROM #tLogins WHERE lngPass = 1

--Reset column for next password test
UPDATE #tLogins
SET lngPass = 0

--Determine if password is only one characcter long
SET @lngCounter = @lngLogCount

WHILE @lngCounter <> 0
BEGIN
    SET @lngCounter1 = 1
    SET @strName = (SELECT strLogin FROM #tLogins WHERE numID = @lngCounter)
    WHILE @lngCounter1 < 256
    BEGIN
        UPDATE #tLogins
        SET lngPass = (SELECT PWDCOMPARE (CHAR(@lngCounter1),(SELECT password FROM master.dbo.syslogins WHERE name = @strName)))
        WHERE numID = @lngCounter
        AND lngPass <> 1
        
        SET @lngCounter1 = @lngCounter1 + 1
    END

    SET @lngCounter = @lngCounter - 1
END

PRINT 'The following logins have one character passwords'
SELECT strLogin AS 'Login Name' FROM #tLogins WHERE lngPass = 1
GO

--Test
EXEC dbo.spAuditPasswords


And last but not least Bradley Morris has published an article about "How to Script User and Role Object Permissions in SQL Server"

Friday, August 25, 2006 2:19:02 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 
 Tuesday, July 11, 2006

The "Microsoft Architect Insight Conference" was held on 22 - 23 March 2006 and the slides are now available for download.

I would highly recommend that you read the PPT about Service-oriented Business Intelligence (SoBI) by Sean Gordon, Robert Grigg, Michael Horne, and Simon Thurman, which brings up some really good new approaches.
The authors also have published an article, which contains a more detailed descriptions and is available online.

And here are two additional links extracted from the article page:

You also should have an eye for the slides of Eric Nelson, who tries to explain that there are seven new servers in the SQL world...

Tuesday, July 11, 2006 11:36:32 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 

You surely know "Project REAL", the SQL Server 2005 reference implementation at Barnes & Noble. It contains information on all upcoming topics in a BI project.

And now...
your are not only able to read about it - you are able to download a whole subset of the project REAL data and the various parts of the implementation

Extract from the website:
"The kit contains:

1. A set of instructions for setting up the environment
2. Guidance on how to explore the implementation
3. A sample relational data warehouse database (a subset of the Project REAL data warehouse)
4. A sample source database (from which we pull incremental updates)
5. SSIS packages that implement the ETL operations
6. An SSAS cube definition and scripts for processing the cube from the sample warehouse
7. Sample SSRS reports
8. Sample data mining models for predicting out-of-stock conditions in stores
9. Sample client views in briefing books for the Proclarity and Panorama BI front-end tools

This kit will guide you through the key points to observe in the Project REAL implementation. Use it to learn and to get ideas for your own implementation. (While we believe it represents a very good design and generally follows best practices, it should not be regarded as the solution for every BI situation.) It will be helpful to see the overview presentations about the BI tools in SQL Server, or read documentation, before exploring the kit. One good source of information is to go through the tutorials that ship with SQL Server (the tutorials are installed when you select “Workstation components, Books Online and development tools” at installation time)."

Tuesday, July 11, 2006 10:59:25 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 

Chris Webb has blogged about the "Business Intelligence Architecture and Design Guide" downloadable at gotdotnet.

I agree with Chris, this is not really new stuff, but I personally think it is good to have informations like this in a kind of "complete package".

Extract from the website:
"The patterns & practices team is please to announce the availability of Architecture and Design Guidelines for Business Intelligence Applications. This exploratory community project provides prescriptive guidance on how to overcome architectural challenges and design issues when building Business Intelligence solutions using Microsoft platform. This guide is intended for software architects and developers who are developing Business Intelligence applications on the Microsoft .NET Framework using SQL Server 2005 - Integration Services and Analysis Services. Being an exploratory community project - anticipate gaps and scope for improvement. For more information see: http://codegallery.gotdotnet.com/biguide."

Tuesday, July 11, 2006 10:47:16 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 
 Tuesday, June 06, 2006

If your users have used Excel 2000 and Pivot Table Services targeting SQL Server 2000 as data store, they probably will get the error message "User 'public' does not have permission to run DBCC TRACEON" - even if you have migrated the whole set of security settings.

Regarding to this link the only way would be to grant execute permissions on DBCC, because:
"[...] SQL Drivers send dbcc traceon(208) to server if client is MS Query for backwards compatibility reasons (turns on support for old quoted identifiers) [...]"

In SQL Server 2000, non-Sys Admins could execute DBCC Traceon (208) - SQL Server 2005 prevents non-Sys Admins from executing DBCC's. Administrators will not get aware of this effect, because they are normally allowed to start a trace in SQL 2005....
So even IF you have tested the whole bunch of Excel files in the company you would not come across this error.

What does this mean for "real life"?
Just deleting your PTS-Excel files and building new ones?
Then I would suggest Reporting Services... ;-)
Screwing your security settings?
Not exactly....
:-)

As mentioned in the forum post, Excel sends a kind of identifier within its query string, which names the calling application and should look like this in the files you are having troubles with:
"APP=Microsoft® Query;"
But have you tried to change the query string in an Excel file afterwards? It is nearly impossible...

Luckily, you could also use this coding:

Sub PT_Connect_Change()

Dim sh As Worksheet, qy As QueryTable
Dim pt As PivotTable, pc As PivotCache
Dim OldPath As String, NewPath As String
Dim rng As Range

For Each ws In ActiveWorkbook.Sheets
   For Each pt In ws.PivotTables
      OldPath = pt.PivotCache.Connection
      NewPath = replace(OldPath, "APP=Microsoft® Query;", "")
      pt.PivotCache.Connection = Application.Substitute(pt.PivotCache.Connection, OldPath, NewPath)
      On Error Resume Next
      If Err.Number <> 0 Then
         'you could write an entire log here...
         msgbox ("Error")
      End If
      pt.PivotCache.Refresh
   Next pt
Next ws

End Sub

This coding loops through all Pivot Table Services Connections in your open Excel Workbook and cuts of the string "APP=Microsoft® Query;" in the connection string and after that refreshes the connection and the data.

To be able to do this without evoking the above mentioned error message do NOT start refreshing of the queries at the beginning and try to avoid any actions with data extraction / connection. After that, start the VBA Editor, paste the coding and run the Sub.
Maybe you will have to wait some minutes because of the refreshing and depending on the ammount of the data and the numbers of connection strings, but this is neccessary - I encountered problems with the connection string change without doing it.

But you could spend the time in getting a coffee, posting a comment and reading this blog, for example...

Tuesday, June 06, 2006 2:37:01 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 
 Wednesday, April 19, 2006

The SQL Server 2005 Service Pack 1 is available now, which updates your SQL Version to Build 9.00.2047.

Microsoft also now has published the "SQL Server 2005 Express Edition with Advanced Services", which contains Reporting Services now, and the "Microsoft SQL Server 2005 Express Edition Toolkit", which contains the Business Intelligence Development Studio and a Software Development Kit!
SQL Server 2005 Express now really is worth a look and it is for free, you will be able to download it here:
http://msdn.microsoft.com/vstudio/express/sql/download/

Wednesday, April 19, 2006 11:17:43 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 
 Monday, March 06, 2006
Monday, March 06, 2006 8:35:41 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 

This video highlights two mission-critical applications within Microsoft that take advantage of SQL Server 2005: MS Sales, a worldwide revenue reporting system, and SAP R/3, an enterprise resource planning system.

http://www.microsoft.com/downloads/details.aspx?FamilyID=2ef438a4-4ae3-4d7b-bfe5-037c954f72c0&DisplayLang=en

Monday, March 06, 2006 7:09:07 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |  |  |   | 

Discussion on how Microsoft IT used SQL Server 2005 to deliver Microsoft Report Analytics, a robust, ad hoc reporting application and MS Sales Business Intelligence, a comprehensive business intelligence solution.

http://www.microsoft.com/downloads/details.aspx?FamilyID=92fbac74-0ca3-4b47-98ca-85014ec5df26&DisplayLang=en

Monday, March 06, 2006 7:06:52 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 

Being annoyed about the Reporting Services Execution Log just bringing up the domain users and having a customer without speaking usernames I searched for a solution to join Execution Log and the Active Directory to enrich the usernames to be able to identify the users.

I discovered a solution by Brendan Thomas "Create a SQL Server View of your AD Users" [2], but I got the same error mentioned in the comments.

The upcoming error could have different reasons:

  • wrong registry entries regarding the ADSDSOObject
  • syntax errors in the query
  • the select statement contains the field "description" - seems that this field is not usable for a query
  • missing user rights - the query is executed in the current user context if the linked server security properties are set to 'run in the actual security context'. If you aren´t using a AD-user the user will not be allowed to query the AD.
    You can switch the settings to 'Be made without a security context' (as mentioned in [3]), but I have to test if the query will be executable without errors then.

After being able to execute the query without errors I searched for other fields that could be extracted from the AD - [6] contains a list.
If anyone has a kind of official listing - please post it in the comments - I was not able to find one using Google...


The extended version of Brendan´s script with the additional fields I needed:

first step:
add the linked server

sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'

second step:
execute query

select
    title,
    sAMAccountName,
    givenname as 'First name',
    middleName as Initials,
    sn as 'Last name',
    displayName,
    telephonenumber as Telephone,
    mail as Mail,
    info as Remarks,
    title as Title,
    department as Department,
    company as Company,
    manager as Manager
from
    openquery
    (
    ADSI,
    'SELECT
        title,
        sAMAccountName,
        givenname,
        middleName,
        sn,
        displayName,
        telephonenumber,
        mail,
        info,
        title,
        department,
        company,
        manager
    
    FROM
        ''LDAP://YourLDAPServer''
    WHERE
        objectCategory = ''Person''
        AND objectClass = ''user''
    '
)

third step:
drop server (if neccessary)

sp_dropserver 'ADSI', 'droplogins'


Searching for the mentioned error code I discovered a query call [5] which could be executed without using the linked server, using OPENROWSET instead of OPENQUERY, but you would have to submit User and Password if you would like to use another user context with the appropiate rights - and this user and his password would be included plain the query...

select
    *
from
    OPENROWSET
    (
    'AdsDsoObject',
    'User ID=;Password=;ADSI Flag=0x11;Page Size=10000',
    'SELECT
        sAMAccountName,
        givenname,
        middleName,
        sn,
        displayName
    FROM
        ''LDAP://YourLDAPServer''
    WHERE
        objectCategory = ''Person''
        AND objectClass = ''user''
    '
)


If you have a large Active Directory you will come across the problem, that calling the AD will only bring up the first thousand users by default using the OPENQUERY (compare [7]).
The parameter Page Size used in the query with the OPENROWSET would override this default value.

Depending on this default, the usage and performance issues I would prefer the data being stored in the SQL Server database - the MS Scripting Guy has a good hint on how to do this:

On Error Resume Next

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objCommand.CommandText = _
"SELECT Name FROM 'LDAP://dc=fabrikam,dc=com' " & _
"WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop


Links:

  1. http://support.microsoft.com/default.aspx?scid=kb;en-us;Q299410
  2. http://codebetter.com/blogs/brendan.tompkins/archive/2003/12/19/4746.aspx
  3. http://www.dbforums.com/archive/index.php/t-958399.html
  4. http://www.codeproject.com/aspnet/LikeDataStores.asp
  5. http://www.mcse.ms/archive81-2005-4-1260672.html
  6. http://forums.aspfree.com/asp-development-5/asp-script-for-querying-active-directory-user-details-using-adsi-21470.html
  7. http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug04/hey0824.mspx

 

If you have any enhancements (for example further fields - I am searching for the domain...) feel free to use the comments.

Monday, March 06, 2006 5:55:58 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [1]   |  |  |  |   | 

You are using SQL Server 2005 and are missing the SQL Server Service Manager which is included in the version 2000?

Jasper Smith helps you out and has published the "SQL 2005 Service Manager" for download.

Monday, March 06, 2006 4:05:11 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Thursday, February 23, 2006

Sorry, German only...

Auf den Seiten des PASS Deutschland e.V. steht ein CommunityCast von Sebastian Weber zum Thema "SQL Server 2005 - CLR Entwicklung" zum Ansehen und zum Download zur Verfügung.

Am 02.03.2006 ab 19.00 Uhr wird es ebenfalls unter dieser Adresse eine Möglichkeit zum Chat mit Sebastian Weber geben, in dem entsprechende Fragen zum Thema CLR Entwicklung gestellt werden können.

Viel Spaß mit dem CommunityCast und herzlichen Dank an Sebastian Weber!

Thursday, February 23, 2006 12:03:12 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 
 Wednesday, February 22, 2006

Lumigent provides a free download of the "Real World SQL Server Disaster Recovery: A Survival Toolkit for the DBA", written by Brian Knight.

The only thing you have to do is to provide your personal informations in a web-form.

Wednesday, February 22, 2006 7:25:41 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |   | 
Wednesday, February 22, 2006 6:43:57 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |   | 

Project REAL is a cooperative effort between Microsoft and a number of technology partners in the business intelligence (BI) industry to build on actual customer scenarios to discover best practices for creating BI applications based on SQL Server 2005. The term REAL in Project REAL is an acronym for Reference implementation, End-to-end, At scale, and Lots of users.

This page gives tons of informations and really is worth reading carefully and staying for hours!

Wednesday, February 22, 2006 5:45:32 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 

SQL Server 2000 Driver for JDBC
this support article maybe usefull for the first steps: Sample connection pool manager for use with Microsoft SQL Server 2000 Driver for JDBC

Microsoft SQL Server 2005 JDBC Driver

Ever thought about connecting your SAP system to your SQL Server?
Coming soon...

Wednesday, February 22, 2006 5:40:10 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 

Without Office 2007 (Office 12) having hit the market you could use this for BI...
But please regard that this download is available at a Microsoft website but is not a supported product, it is just a demonstration - but it is a really good one!

Business Intelligence Portal Sample Application for Microsoft Office 2003

Extract from the website:
"The business intelligence portal sample application for Microsoft Office 2003 is an integrated, customizable, multilingual, Web-based OLAP solution that enables employees in an organization to create and share structured views (OLAP and Relational) and unstructured views (Documents and URLs), based on various data sources, such as SQL Server 2000 Analysis Services, offline cube files, relational databases, SQL Server Reporting Services reports, spreadsheet data files, XML Web services, XML files, and any requested URL.
The business intelligence portal is entirely built on top of Microsoft Windows® SharePoint® Services. It extends Office Web components capabilities, and uses SQL Server Reporting Services. The BIP Viewer is a smart Web Part that can show multiple views from multiple sources and filter data based on Web Part connections with other Web Parts such as the Business Scorecard accelerator.
The business intelligence portal also contains an add-in for Office 2003, that enables end users to consume reports and OLAP-based views (charts and PivotTable reports) directly into Microsoft Outlook®, Microsoft PowerPoint®, Microsoft Excel, and Microsoft Word documents. This can streamline their daily work, and enhance their business productivity."

Wednesday, February 22, 2006 4:12:49 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |  |   | 
 Thursday, February 02, 2006

Scott Lowe privides some interesting informations about pitfalls in his article

This tutorial shows you how to properly install Microsoft's SQL Server 2005, avoiding the pitfalls of an unsuccessful deployment.

Thursday, February 02, 2006 11:19:02 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |   | 
 Thursday, January 12, 2006

Have you thought of writing your own backup application for SQL 2005?
You will not, have you? ;-)

It seems almost incredible that you affirmed this, but then this article "SQL Writer in SQL Server 2005: A Guide for SQL Server Backup Application Vendors" should be the right stuff for you.

Thursday, January 12, 2006 6:29:26 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |   | 
 Wednesday, January 04, 2006

Have you also moaned about setting security for your stored proc´s?
I am shure, you have!
;-)

The following script should help you to set security - if you are using namespaces für your sproc´s....

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[spr_grantproc]') and OBJECTPROPERTY(id,
N'IsProcedure') = 1)
drop procedure [dbo].[spr_grantproc]
GO

CREATE procedure spr_grantproc
@login varchar(50),
@prefix varchar(50),
@grant bit
/* allocates the security settings to all SP´s beginning with the defined prefix (without itself)
@grant=1 grant access
@grant=0 revoke access
@login User-Login */


AS

declare @grantsql as sysname
declare @action as varchar(6)

if (@grant=1)
   set @action='GRANT'
else
   set @action='REVOKE'

if (@login is not null)
begin
   SELECT
      
@Action+' EXECUTE ON ' + [NAME] + ' TO ' + @login as sel
   into
      
#granttbl
   from
      
SYSOBJECTS
   WHERE
      
TYPE = 'P'
      AND LEFT(NAME,LEN(@prefix)) = @prefix
      AND [NAME]<>'spr_grantproc'
   DECLARE Cur CURSOR FOR
   SELECT sel FROM #granttbl
   OPEN Cur
   FETCH NEXT FROM Cur into @grantsql
      WHILE @@FETCH_STATUS = 0
         BEGIN
            exec(@grantsql)
            FETCH NEXT FROM Cur into @grantsql
         END
   CLOSE Cur
   DEALLOCATE Cur
   drop table #granttbl
end

GO

Wednesday, January 04, 2006 5:36:13 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 

I came across a MySQL database during a project last days and had to migrate it to a MS SQL Server database. ;-)

I could have printed the ER-diagram and rebuild the tables, but... I have discovered a real cool and cheap tool to do this!
Take a look at the MySQL-to-MSSQL migration tool from intelligent converters.

My tip is to convert just the metadata and do the data transformation using DTS or SSRS, this is much faster.

They also provide other converters worth a look.

Wednesday, January 04, 2006 5:02:00 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 

I found the following code somewhere in the internet sometimes ago, but did not store the link, if someone wants to be honoreed for creation - please mail to me!

But be carefull, this sproc is using dynamic statements via exec '' and therefor alos including all upcoming issues...
Not known? Than you have to read the article "The Curse and Blessings of Dynamic SQL" from Erland Sommarskog.

Here we go:

CREATE PROCEDURE spr_GetSortedPage(
@TableName VARCHAR(50),
@PrimaryKey VARCHAR(25),
@SortField VARCHAR(100),
@PageSize INT,
@PageIndex INT = 1,
@QueryFilter VARCHAR(100) = NULL
) AS
SET NOCOUNT ON

DECLARE @SizeString AS VARCHAR(5)
DECLARE @PrevString AS VARCHAR(5)

SET @SizeString = CONVERT(VARCHAR, @PageSize) SET @PrevString = CONVERT(VARCHAR, @PageSize * (@PageIndex - 1))

IF @QueryFilter IS NULL OR @QueryFilter = ''
BEGIN
   EXEC(
      'SELECT * FROM ' + @TableName + ' WHERE ' + @PrimaryKey + ' IN
      (SELECT TOP '
+ @SizeString + ' ' + @PrimaryKey + ' FROM ' + @TableName + ' WHERE ' + @PrimaryKey + ' NOT IN
      (SELECT TOP '
+ @PrevString + ' ' + @PrimaryKey + ' FROM ' + @TableName + ' ORDER BY ' + @SortField + ')
      ORDER BY '
+ @SortField + ')
      ORDER BY '
+ @SortField
   )
   EXEC('SELECT (COUNT(*) - 1)/' + @SizeString + ' + 1 AS PageCount FROM ' + @TableName)
END
ELSE
BEGIN
   EXEC(
   'SELECT * FROM ' + @TableName + ' WHERE ' + @PrimaryKey + ' IN
   (SELECT TOP '
+ @SizeString + ' ' + @PrimaryKey + ' FROM ' + @TableName + ' WHERE ' + @QueryFilter + ' AND ' + @PrimaryKey + ' NOT IN
   (SELECT TOP '
+ @PrevString + ' ' + @PrimaryKey + ' FROM ' + @TableName + ' WHERE ' + @QueryFilter + ' ORDER BY ' + @SortField + ')
   ORDER BY '
+ @SortField + ')
   ORDER BY '
+ @SortField
   )
   EXEC('SELECT (COUNT(*) - 1)/' + @SizeString + ' + 1 AS PageCount FROM ' + @TableName + ' WHERE ' + @QueryFilter)
END

RETURN 0
GO

Doing it this way brings up to resultsets in one call - because of classic ASP having trouble with that you have to exclude the second exec´s bringing up the page-information and put them in seperate sproc´s.

Wednesday, January 04, 2006 3:22:20 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |   | 

Eric Bracke provides a cool tool named SQL Digger which enables searching in Stored Procedures, UDF´s, Views and Triggers.

He also provides guides to add it into SQL Enterprise Manager or in the .NET IDE.

Wednesday, January 04, 2006 2:52:10 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
 Monday, January 02, 2006

I just came across this post from Bayer White who is a co-blogger of Brian Knight - they are sharing this Community Server.

There is a website available called msbicentral.com, regarding to the post, this should be a "pilot community and the "the "GOTO", place for Business Intelligence knowledge".

Extraxt from the website:
"Wayne, Brian and I spoke about what the future holds for MSBICentral and came to the conclusion that there were not enough BI Communities. We decided we should do more and make sure that are content is up to date and give examples of BI techniques for 2005. Please hold me accountable to this!"

I think we should do this... ;-)


Extract from msbicentral.com:
"MSBICentral.com is a community site that helps users like yourself learn to develop, use and administer Business Intelligence (BI) solutions using Microsoft products like SQL Server. On this site, you'll find hundreds of articles, scripts and tutorials to help you learn or perfect your BI skills. If you have a question or if you're a business intelligence newbie, look on the left bar for some quick links to get you started.
Please note: You'll need to be logged in with your free account to see articles and use much of the site."

And be ashured, registering is really worth investing the two minutes to fill out the form!

Monday, January 02, 2006 3:11:34 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |   | 

As Chris Webb posted here, there is a "SQL Server 2005 Business Intelligence Metadata Samples Toolkit", which brings up "Tools and Sample reports for Metadata Dependency Analysis of SSIS, SSAS", available for download for free.

Extract from the website:
"Microsoft SQL Server 2005 BI Metadata Samples provides tools and samples for analysing dependencies within and across SSIS and SSAS. The source code for the tools is provided.
The following are the components of this pack:
DependencyAnalyzer: a utility that scans SSIS packages and SSAS databases for enumerating metadata (objects, properties and dependencies).
DependencyViewer: a utility to view metadata organization & inter-dependencies (lineage/impact analysis).
Analysis Services Samples : sample SSAS packages that can be analyzed
Integration Services Samples: sample SSIS packages that can be analyzed
Report Model Samples (Report Builder): report builder model
Reports: sample reports built from metadata store
SQL: SQL script for creating metadata store
"


You will also be able to download a whitepaper called "SQL Server 2005 Business Intelligence Metadata Whitepaper".

Extract from the website:
"This white paper covers several interesting and unique methods for managing metadata in SQL Server Integration Services, Analysis Services and Reporting Services using built-in features including data lineage, business and technical metadata and impact analysis."

Monday, January 02, 2006 2:32:07 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |  |  |   | 

Download an updated version of the documentation and tutorials for Microsoft SQL Server 2005.

Extract from the website:
"Download an updated version of Books Online for Microsoft SQL Server 2005. Books Online is the primary documentation for SQL Server 2005. The December 2005 update to Books Online contains new material and fixes to documentation problems reported by customers after SQL Server 2005 was released. Refer to "New and Updated Books Online Topics" for a list of topics that are new or updated in this version. Topics with significant updates have a Change History table at the bottom of the topic that summarizes the changes.

Books Online includes the following types of information:

  • Setup and upgrade instructions.
  • Information about new features and backward compatibility.
  • Conceptual descriptions of the technologies and features in SQL Server 2005.
  • Procedural topics describing how to use the various features in SQL Server 2005.
  • Tutorials that guide you through common tasks.
  • Reference documentation for the graphical tools, command prompt utilities, programming languages, and application programming interfaces (APIs) that are supported by SQL Server 2005.
  • Descriptions of the sample databases and applications included with SQL Server 2005."


Download over 100 samples and three sample databases for SQL Server 2005.

Extract from the website:
"The samples download provides over 100 samples for SQL Server 2005, demonstrating the following components:

  • Database Engine, including administration, data access, Full-Text Search, Common Language Runtime (CLR) integration, Server Management Objects (SMO), Service Broker, and XML
  • Analysis Services
  • Integration Services
  • Notification Services
  • Reporting Services
  • Replication

The samples databases downloads include the AdventureWorks sample online transaction processing (OLTP) database, the AdventureWorksDW sample data warehouse, and the AdventureWorksAS sample Analysis Services database. These databases are used in the samples and in the code examples in the SQL Server 2005 Books Online."

Monday, January 02, 2006 2:13:57 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |  |  |   | 

The Microsoft SQL Server 2005 System View Map shows the key system views included in SQL Server 2005, and the relationships between them.

This is really huge - fun anyone while reading online?
I hope you have a DinA 0 - Plotter available for printing?
;-)

Monday, January 02, 2006 1:59:37 AM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |   | 
 Tuesday, December 27, 2005

This link provides the downloadable bits for the SQL Server Web Data Administrator and some hints.

Especially you will be interested in the following:
"Note: The SQL Web Data Administrator is not officially supported by Microsoft Product Support Services (PSS). If you require support for this tool, post your question in the SQL Web Data Administrator forum on the SQLJunkies site at http://www.sqljunkies.com/forums/.

The SQL Server Web Data Administrator enables you to easily manage your SQL Server data, wherever you are. Using its built-in features, you can do the following from Microsoft Internet Explorer or your favorite Web browser:

  • Create and edit databases in SQL Server 2000 or Microsoft SQL Server 2000 Desktop Engine (MSDE 2000)
  • Perform ad-hoc queries against databases and save them to your file system
  • Export and import database schema and data
  • Manage users and roles
  • View, create and edit stored procedures

Whether you are doing Microsoft Windows or Web development, or just need remote access to data for yourself or your clients, the Web Data Administrator is the perfect complement to your toolbox."

Tuesday, December 27, 2005 7:48:51 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |   | 

Sorry, German only...

Der Artikel "SQL Server Objekte scripten" beschreibt, wie man sowohl mit dem Enterprise Manager als auch mit einer ASP-Seite Objekte des SQL Servers skripten kann.
Realisiert wurde das Ganze über SQL-DMO, weitere Beispiele und Anregungen dazu gibt es hier.

Tuesday, December 27, 2005 6:46:43 PM (Mitteleuropäische Zeit, UTC+01:00)  #     Author:Markus Fischer   Comments [0]   |  |   | 
Copyright © 2010 Markus Fischer. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: