Deprecated: Assigning the return value of new by reference is deprecated in /home/protean/public_html/b/wp-includes/cache.php on line 33
Protean » Microsoft

Archive for the 'Microsoft' Category

SSIS SQL Command Component Inline Comments

Tuesday, August 14th, 2007

The SQL Command OLE DB component doesn’t like inline comments when using the Native SQL Server OLEDBConnection. Leave them in your SQL Code and you get the following error:-

An OLE DB error has occurred. Error code: 0×80004005.  An OLE DB record is available.  Source: “Microsoft SQL Native Client”  Hresult: 0×80004005  Description: “Syntax error, permission violation, or other nonspecific error”.

Take them out and hey presto…

SSIS Pivot Component Example

Thursday, August 2nd, 2007

It may be me, but as yet I haven’t seen too much written about the SSIS pivot and unpivot components.

Whilst they are not the easiest to configure, when faced with the option of importing to SQL Server and using a UNION or the new PIVOT clauses, I actually prefer the SSIS component.

Rather than actually explain the component, I thought it might be useful to go through a real example, so here goes…

Professional ASP.NET 3.5: In C# and VB (Programmer to Programmer)

(more…)

Managing new publications and subscriptions

Tuesday, May 22nd, 2007

In my never ending quest to simplify administration tasks on SQL Server, I recently came up with a method to automate the creation of new publications with a one script fits all piece of SQL Code.

Considering that in most enterprises, the default configuration options for replication will remain the same, the only thing that changes are the destination servers and the publications/articles themselves.

A Guide to SQL Server 2000 Transactional and Snapshot Replication

(more…)

SSIS & Excel (Part 2)

Monday, March 5th, 2007

More Excel woes with SSIS…

Be very careful when using Excel as your transformation destination. Given that it is hard to maintain a consistent controlled version of any excel file you are using, it can be very prone to fail on account of the encoding that is used within it.

Excel 2003 Power Programming with VBA

(more…)

A sproc as an OLE DB Source

Wednesday, February 14th, 2007

Remember when you use a Stored Procedure as the OLE DB Source that you need to turn off the ‘x many rows affected’ statement at the end.

Do this by including in the CREATE PROCEDURE script the statement:

SET NOCOUNT ON

Also, ensure that you make the full call to the procedure:

EXEC spStoredProcedure @myString = ?, @myInteger = ?

This makes parameter mapping much easier, however, don’t expect to be able to preview the data… this only seems to work at run-time.

Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL and .NET

Tokenize a String

Tuesday, February 13th, 2007

We try to avoid SQL Server user-defined functions unless we can be certain that there is no other way to achieve what it is we’re asking of them. They aren’t very performant as they calculate on a row by row basis rather than the set based operations that our esteemed RDMS is renowned for.

Having said this I am going to post a table function I created recently for use as part of an SSIS import package that transforms an incoming single row CSV into roughly 100 records each time it runs.

The content team in our organisation faces the soul-destroying task of entering records as well as comma delimited strings on to an Excel spreadsheet which in turn is imported into 2 SQL tables.

There is no straight forward way to split the csv string into a SELECT list, but here is what I have done…

Studio 8 Student & Teacher Edition (Includes: Flash Professional 8, Dreamweaver 8, Fireworks 8, Contribute 3, and FlashPaper 2) 

(more…)

SQL Agent Reset

Thursday, February 1st, 2007

Ever had a multitude of SQL Agent jobs with dependencies on one another in order for your nightly batch to succeed? Ever had a situation where you forgot to set the steps correctly within the job resulting in the batch failing or not even running at all?

Me too… here’s what I did in order to protect myself from human error.

Inside SQL Server 2005: T-SQL Programming (Solid Quality Learning) 

(more…)

Another use for a bitwise operator

Monday, January 29th, 2007

I have just finished the code for a new transactional replication setup.

Requirements were to be able to filter rows according to the destinations that formed part of the fullfilment of the order. This could theoretically include up to 10 destinations however in reality it tended to be 2 or 3. The data would be real-time messages flowing out of the mainframe into the SQL Server via BizTalk.

Pro SQL Server 2005 Replication (Definitive Guide) 

(more…)

A useful script to analyse current queries on your box…

Monday, January 22nd, 2007

Ever been stuck trying to figure out what people are doing on your server, but unable to tell from DBCC InputBuffer what statements the users are running? This is one of the most useful scripts I’ve come accross and helps enormously when trying to analyse what is happening on your SQL Server.

It is often the case that users will query your database with tools like MS Access or Business Objects which are quite difficult to track. Well this useful tool helps to solve that problem… 

SQL Server 2005 Administrator\'s Pocket Consultant (Pro-Administrator\'s Pocket Consultant) 

(more…)

Excel & SSIS (Part 1)

Monday, January 15th, 2007

Came across an irritating behaviour with the Excel source in SSIS. The Excel ODBC Jet Driver that SSIS uses has the annoying default configuration of only checking the first 8 lines in a spreadsheet, to evaluate the field length of any external columns in the Excel source task…

Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft Excel and VBA

(more…)