The DaxMindMapper Reloaded

Darrell Russell. A Software Contractor with over 10 years development experience. He is an experienced Microsoft .NET software developer specialising in C#, VB.NET, SQL Server Databases, ASP/ASP.NET web sites, XML, Web Services, WinForms, WCF and WFF development and consultancy work on a freelance basis. Based in the South West of the UK (Tetbury, Gloucestershire) and available to do work within South Wales, the M4 corridor, Gloucestershire, Dorset, Oxfordshire, Wiltshire and Somerset including Bath, Bristol, Swindon, Cheltenham, Gloucester and Salisbury. At the moment he is particulary interested in Agile Software development methodologies including Test Driven Development (TDD).

July 29, 2009

SQL Server 2005 Northwind Example Database

Filed under: SQL Server — Dax++ @ 12:12 pm

Looking at the S#arp Architecture for a new project I’m working on.

The example it supplies requires the Northwind database. Hey no problem I think .. it comes with SQL Server so shouldnt be an issue. First problem .. Microsoft no longer install this example database with their later SQL Server versions (actually this no bad thing for a whole bunch of reasons so I’m not angry at this point). However they then go onto make it rather difficult to actually recreate this standard example database.

Googling for “northwind database for sql 2005″ will come up with links to the old Microsoft download area, which then directs you to codeplex, which then offers you a large download for all of the old example databases that, unfortunately, does not actually include the bl**dy Northwind database.

Finally found this link .. looks like the way to go. I’ll try out the SQL script install and see how it goes.

June 15, 2009

SQL Server Indexes

Filed under: Databases, SQL Server — Dax++ @ 9:17 am

Looks like an excellent overview to indexes

Always difficult to find good info on the technology that goes into databases (ie stuff thats detailed enough but not so dry that you fall asleep trying to wade through it). So this appears to be an good article for developers wanting more info on Indexes.

October 20, 2008

Test-Driven Development of T-SQL Code

Filed under: SQL Server, Testing, Unit — Dax++ @ 10:14 am

Test-Driven Development of T-SQL Code - an article on using TSQLUnit to TDD the database layer. TSQLUnit is a open source framework to write tests for applications written in Transact-SQL.

Will need to investigate this technique the next time I come to create some T SQL. It’s an area (along with UI testing patterns) that I’ve been wondering about for some time. Just never had the excuse to get my hands dirty and come up with a position on it.

March 9, 2007

The Rational Guide to SQL Server 2005 Service Broker

Filed under: .NET v2, Books, Messaging, SQL Server — Dax++ @ 12:35 pm

The Rational Guide to SQL Server 2005 Service Broker by Roger Wolter (ISBN 1-932577-27-0)

Excellent overview, short and sweet.

As with most technical books it helps if you have experience in the problem domain that the subject is attempting to solve. In this case I’ve spent a fair few years using MSMQ as a messaging environment, I’ve also used Biztalk to orchestrate some simple business rules and I’ve also seen queuing implemented in a number of SQL Server databases via tables and sprocs .. so yes I’d say I have just a little bit of experience in the problem domain area.

This book is not a reference book, it’s not hard core and it doesn’t offer loads of practical advice.

That said I’d still recommend this book to anyone that wants a gentle introduction to Service Broker.

Couple of points around Service Broker itself:
1. It looks great .. can’t wait to use it in anger. It solves so many messaging issues.
2. How does SB fit into the architecture along side .NET 3 Work Flow? I’m going to be looking into WF and hopefully it’ll become clearer.
3. I’m interested in the external application activation but it’s not clear from the book how this would work - probably the one thing I’d mark the book down on becuase it’s something everyone will want to do for any decent sized, real world application of Service Broker. Apparently there’s more info on this area at http://www.gotdotnet.com/codegallery/codegallery.aspx?id=9f7ae2af-31aa-44dd-9ee8-6b6b6d3d6319
4. I’m interested in scalability .. the book talks about it and I’m sure the people that brought us SB will have thought it through but I’d like to see more and check more real world experiences.
5. I’m sure there will be more updates to this technology - it’s so extensable I’d be amazed if it isn’t.

March 5, 2007

Microsoft relaxes virtual SQL Server terms

Filed under: SQL Server, Virtualisation — Dax++ @ 5:00 pm

Microsoft relaxes virtual SQL Server terms - Users can now run an unlimited number of SQL Server 2005 Enterprise Edition virtual instances on servers. Servers must already be fully licensed for SQL Server 2005 Enterprise Edition.

Good news surely :)

February 21, 2007

SQL Server 2005

Filed under: .Net, SQL Server — Dax++ @ 11:44 am

One of my other pet interests, at the moment, is the way in which SQL Server 2005 can be used in a SOA Architecure. I’m particularly interested in the Server Broker technology.

How SQL Server 2005 Enables Service-Oriented Database Architectures - Good overview.

December 20, 2006

OLTP Blueprint - A Performance Profile of OLTP applications

Filed under: Databases, SQL Server — Dax++ @ 11:52 am

Microsoft SQL Server Development Customer Advisory Team’s Best Practice for OLTP profiling

Interesting list of checks for SQL Server(?) based OLTP databases .. it’s always a little difficult to find concrete guidelines for optimising databases, so it’s nice to see an actua checklist from the peopel that know.

April 6, 2006

T-SQL Create Data Load for the Contents of a Table

Filed under: SQL Server — Dax++ @ 1:14 pm

It runs now but very flakey!

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

CREATE Procedure [dbo].usp_CreateDataLoadScript @TblName varchar(128) as
/*
exec sp_CreateDataLoadScript 'MyTable'

History
=======

22/08/2006 DR Amended to fix uniqueidentifier bug (there will be many others)

*/

create table #a (id int identity (1,1), ColType int, ColName varchar(128))

insert #a (ColType, ColName)
select case
when DATA_TYPE like '%char%' then 1
when DATA_TYPE like '%unique%' then 2
else 0 end ,
COLUMN_NAME
from information_schema.columns
where TABLE_NAME = 'CallResponseStatus' --@TblName
order by ORDINAL_POSITION

if not exists (select * from #a)
begin
raiserror('No columns found for table %s', 16,-1, @TblName)
return
end

declare @id int ,
@maxid int ,
@cmd1 varchar(7000) ,
@cmd2 varchar(7000)

select @id = 0 ,
@maxid = max(id)
from #a

select @cmd1 = 'select '' insert ' + @TblName + ' ( '
select @cmd2 = ' + '' VALUES ('' + '
while @id < @maxid
begin
select @id = min(id) from #a where id > @id

select @cmd1 = @cmd1 + '[' + ColName + '],'
from #a
where id = @id

select @cmd2 = @cmd2
+ ' case when ' + ColName + ' is null '
+ ' then ''null'' '
+ ' else '
+ case
when ColType = 1 then ''''''''' + ' + ColName + ' + '''''''''
when ColType = 2 then ''''''''' + ' + 'convert(varchar(100),' + ColName + ')' + ' + '''''''''
else 'convert(varchar(100),' + ColName + ')'
end
+ ' end + '','' + '
from #a
where id = @id
end

select @cmd1 = left(@cmd1,len(@cmd1)-1) + ' ) '' '
select @cmd2 = left(@cmd2,len(@cmd2)-8) + '+ '')'' from ' + @tblName

select '/*' + @cmd1 + @cmd2 + '*/'

exec (@cmd1 + @cmd2)
drop table #a
GO

March 21, 2006

Moving SQL Server databases

Filed under: SQL Server — Dax++ @ 10:17 am

When moving SQL Server databases around user logins invariably get orphaned.

Heres a usefull script to osrt out these orphaned user accounts:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

Create PROC dbo.usp_Repair_Orphan_Users(@targetdbname nvarchar(50) = null)
AS
-------------------------------------------------------------------------------
-- Description: This is a DBA utility used to resync all user/login sids,
--
-- Revision History
-- Date Author Revision Description
-- 09/07/2005 Tduffy Original version
-- 19/12/2005 DRussell Amended for so that database name must
-- be supplied.
-------------------------------------------------------------------------------
-- Parameters None
-------------------------------------------------------------------------------
-- Example
-- EXEC usp_Repair_Orphan_Users 'MyDBName'
-------------------------------------------------------------------------------

set nocount on

DECLARE @cmd varchar(4000)

BEGIN

Create table #Orphan_User_Tbl

(
[Database_Name] sysname COLLATE Latin1_General_CI_AS,
[Orphaned_User] sysname COLLATE Latin1_General_CI_AS
)

SET NOCOUNT ON

DECLARE @DBName sysname, @Qry nvarchar(4000)

SET @Qry = ''
SET @DBName = ''

WHILE @DBName IS NOT NULL

BEGIN
SET @DBName =
(
SELECT MIN(name)
FROM master..sysdatabases
WHERE name NOT IN
(
'master', 'model', 'tempdb', 'msdb',
'distribution', 'pubs', 'northwind'
)
AND DATABASEPROPERTY(name, 'IsOffline') = 0
AND DATABASEPROPERTY(name, 'IsSuspect') = 0
AND DATABASEPROPERTY(name, 'IsInload') = 0
AND DATABASEPROPERTY(name, 'IsInRecovery') = 0
AND DATABASEPROPERTY(name, 'IsInStandBy') = 0
AND DATABASEPROPERTY(name, 'IsReadOnly') = 0
AND DATABASEPROPERTY(name, 'IsNotRecovered') = 0
AND (@targetdbname is null OR Name = @targetdbname) AND name > @DBName -- DR Amend

)

IF @DBName IS NULL BREAK

SET @Qry = ' SELECT ''' + @DBName + ''' AS [Database Name],
CAST(su.name AS sysname) COLLATE Latin1_General_CI_AS AS [Orphaned User]
FROM ' + QUOTENAME(@DBName) + '..sysusers su
inner join master..sysxlogins b
on su.name=b.name
where
su.sid is not null
and su.sid not in (0x00,0x01)
and su.sid <> b.sid'

INSERT INTO #Orphan_User_Tbl EXEC (@Qry)
END

DECLARE MC CURSOR
READ_ONLY
FOR

SELECT [Database_Name]+ '..sp_change_users_login ''Update_One'' , ''' + Orphaned_User + ''',''' + Orphaned_User + ''''
FROM #Orphan_User_Tbl
ORDER BY [Database_Name], [Orphaned_User]

OPEN MC

FETCH NEXT FROM MC INTO @cmd
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
--Print @cmd
Execute (@cmd)
END
FETCH NEXT FROM MC INTO @cmd
END

CLOSE MC
DEALLOCATE MC

DROP Table #Orphan_User_Tbl

END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Powered by WordPress