Tuesday, July 22, 2008

Andrew Fryer's Blog : Microsoft SQL Server Community Utilities

 

Microsoft SQL Server Community Utilities

As well as the independent SQL communities, there is also a Microsoft run one, the Microsoft SQL Server Community Worldwide ( You can tell it’s the Microsoft one by the catchy title).  They do tend to assume worldwide is the United States wide or even the Seattle area so you can drop in to Redmond for SQL school.  However don’t let that put you off, there is some really good stuff there including a list of utility scripts here  as long as your arm for probing the dark corners of your installations:

Andrew Fryer's Blog : Microsoft SQL Server Community Utilities

Charlie Maitland’s Blog

Charlie has a huge amount of links on BI, Axtapa & Dynamix.

Charlie Maitland’s Blog

Jason Morales' Microsoft BI Update

 

Enterprise & Standard Edition Feature Comparisons:

- Microsoft SQL Server 2008

- Microsoft SQL Server 2005

Business Intelligence features of SQL Server Enterprise Edition:

(that are not in the Standard Edition)

Advanced Analytics

- Account intelligence

- Linked measures and dimensions

- Perspectives

- Semiadditive measures

- Writeback dimensions

Scalability and Performance

- Proactive caching

- Partitioned cubes and distributed partitioned cubes

- Auto parallel partition processing

Integration Services

- Data mining query transformation

- Data mining model training destination adapter

- Fuzzy Grouping transformation

- Fuzzy Lookup transformation

- Term Extraction transformation

- Dimension processing destination adapter

- Partition processing destination adapter

Reporting Services

- Data-driven subscriptions

- Report scale-out deployment

- Infinite clickthrough in ad-hoc reports

- Scale-out operational report configuration**

Data Warehousing

- Data compression**

- Star join query optimizations**

- Change data capture (CDC)**

- Scalable data marts and reporting**

Data Mining

- Parallelism for model processing & prediction

- Advanced Data Mining algorithms with algorithm plug-in API

- Advanced configuration and tuning options for data mining algorithms

- Time series capabilities**

** double-star denotes feature of SQL Server 2008

Introduction to New Data Warehouse Scalability Features in SQL Server 2008

Jason Morales' Microsoft BI Update

Tuesday, July 15, 2008

Mark Malakanov poorly maintained blog: July 2007

One workaround for the notoriously slow insert times from SSIS into Oracle.

SSIS 2005. How to avoid Autocommit when load into OLE DB destination.

An example with using of Oracle OLE DB driver on a destination side.

I have heard from my friend that he is experiencing very slow load into Oracle database. He used SSIS 2005. Which is funny, because Oracle Warehouse Builder is available. Anyway.
The cause of slowness of SSIS, when it loads into non-Microsoft OLE DB target, appeared to be the commit after every insert. Since the ‘Autocommit’ is set to be ‘ON’ by OLE DB standard, a driver propagates this mode to the database. The only way to turn it off, is to switch OLE DB datasource into a Transactional mode by issuing a BeginTransaction() call.

Mark Malakanov poorly maintained blog: July 2007

Error Handling in SSIS - SQL Server Central

Borrowing liberally from Jack Corbett's scripts will get you a great custom error handler.  No more creating and maintaining error tables for SSIS data flows!

Anyone who has used SSIS error handling has been frustrated that it returns an Error Code with no description. I decided that I needed a solution. Googling the problem led me to this blog by Jamie Thomson which had a link to a Script Component that gets the Error Description. Excellent! While this was I good start, I also wanted to see the data that caused the error. I started by including the data and outputting to a text file, but, being a database pro, this did not sit well with me. I started looking for a solution that would allow me to store the data in a table and be useable in each dataflow task, and, once again, the internet provided a solution, this article by jwelch on agilebi.com which I highly recommend reading.

My solution is uses the Input0_ProcessInputRow method and reflection, as shown by jwelch’s article, to loop through the columns, building an XML string (name-value pairs) which I insert into a table. I can then query the table to see the errors and the data. I can then verify that I fixed the errors from earlier loads.

Here is the solution:

Error Handling in SSIS - SQL Server Central

Call stored procedure inside SSIS Script task

Useful way to build custom data flow scripts, with increased performance benefits in Oracle, and access to other custom data providers and APIs.

I would like to call stored procedure inside Script task.
Any example out there?

Call stored procedure inside SSIS Script task

BI Thoughts and Theories : Address Columns Generically In a Script Component

Also useful when building a custom error script in SSIS.

Address Columns Generically In a Script Component

When writing script components in SSIS, it's often useful to be able to process the columns without knowing exactly what they are. For example, you may want to loop through all the columns to check for a conditional, like NULL values in the columns. Or you may want to take a set of columns and concatenate them into a single string for output, or output each one as an XML element. In any of these cases, you don't necessarily care about the individual column details.

One option is to use Reflection. This is fairly easy to set up, but is not the fastest performing option. To use Reflection, add this to the top of the Script class:

BI Thoughts and Theories : Address Columns Generically In a Script Component

BI Thoughts and Theories : XML Transformations Part 2

After a bit of frustrations, I got this to work with a SqlClient rather than an OLE DB client by parsing out the connection string and doing a string replace to remove the provider and other invalid information.

I'm using something similar to create a custom error handler that exports to an XML column.  No more error tables for each dimension table.

The script is very similar to the one from the previous article, though it is a bit simpler. The XML values are prepared by iterating through the Input Collection metadata, and using the Reflection classes to read the Row object dynamically. The resulting value is put into the XML column on the output.

The OLEDB Destination simply maps the XML column to an XML column on a database table.

This is a good alternate approach to the previous one, particularly if you need to send the XML to a database instead of a flat file.

BI Thoughts and Theories : XML Transformations Part 2

Thursday, July 10, 2008

Magic Quadrant for Business Intelligence Platforms, 2008

Gartner has released the 2008 Magic Quadrant for BI Platforms.

Looks like BI has come of age, according to Gartner.  We have leveled off and are coasting rather than innovating.

Note that for the 2008 Magic Quadrant, given the maturity of the market, the Innovation criterion was not rated separately. Instead, it was factored into the Market Understanding and Offering (Product) Strategy criteria.

Magic Quadrant for Business Intelligence Platforms, 2008

SAS is the visionary leader, not much surprise here.  Microsoft and Cognos are the overall leaders.  Panorama, arcplan, and newcomer Board International are all niche players. 

Truly the last two years have been one of consolidation.  The next few years should see another round of innovation and new product offerings, if the cycles continue.

One interesting product that IBM returned to the mothership was Cognos.  It's technology that came out of IBM now returning to the fold.

The one player that's missing from this puzzle?  Google.

Companies such as Panorama are now promoting integration with Google technologies, though this article from 2006 seems to promote the idea of Google itself as a BI tool.  When I think of BI in terms of the quadrant I think of reporting rather than searching, so Google really doesn't fit into this space just yet - unless you want to count Google Analytics.

It will be interesting to see what the next year brings, with the launch of SQL 2008, PerformancePoint improvements, Microsoft's MDM tools, integration of Cognos and Applix with IBM software, and whatever happens with SAP and their BO.

My first pick would be an easy-to-use tool that brings relational, unstructured and multidimensional cube data together under one umbrella with point & click or easily maintainable scripts for ETL consolidation and data scrubbing, and a place to put planning numbers and napkin-style forecasts.  Preferably with some fancy charts, graphs, dashboards, and output to PDF, Powerpoint & Excel (and Visio?).  Without any installation or security hassles, java virtual machines, memory leaks, bloatware, or incompatibilities with other software.

What about using the OCZ NIA as an interface and the NVidia Tesla GPU for calculations?  Why not add a little e-Ink to help save some trees?

Too much to ask?

Microsoft Certified Master Product Overviews and Requirements

There are 3 new certifications out of Microsoft... the "Masters" series.

Microsoft Certified Master Product Overviews and Requirements

Published: June 10, 2008

IT professionals who hold Microsoft Certified Master technology-based certifications are recognized as holding the highest level of technical certification for Microsoft server products. Find out if you have what it takes to become a Microsoft Certified Master by reading the program overviews and prerequisites.

Microsoft Certified Master Product Overviews and Requirements

Tuesday, July 08, 2008

Deprecated Database Engine Features in SQL Server 2008

A few of the more common things that will probably break your SQl 2008 upgrade if you have not run the upgrade advisor for SQL 2005 & corrected them:

Database compatibility < 80

*= & =* joins

SET ROWCOUNT for INSERT, UPDATE, DELETE

RAISERROR syntax

More here...

Deprecated Database Engine Features in SQL Server 2008

Changes that may break SQL 2000 - 2005 upgrade.

http://msdn.microsoft.com/en-us/library/bb510680(SQL.100).aspx

Thursday, July 03, 2008

Missing Date Ranges- the Sequel

Time intelligence - a missing component of SQL - is available with some scripts like these.

Missing Date Ranges- the Sequel

Introduction to the Transaction Log - SQL Server Central

Excellent article about transaction logs in SQL.  My best tip:  Always backup the transaction log and clear unused entries.  If your log hasn't been backed up before, back it up twice to be able to shrink it.  Never use the TRUNCATE command. It is much safer to use the backup facility to maintain the log.

Introduction to the Transaction Log - SQL Server Central

Monday, June 30, 2008

.NET HITMAN: Difference between LINQ to SQL and the Entity Framework

Some good scalability points on using LINQ in Enterprise applications.

So while there is a lot of overlap, LINQ to SQL is targeted more toward rapidly developing applications against your existing Microsoft SQL Server schema, while the Entity Framework provides object- and storage-layer access to Microsoft SQL Server and 3rd party databases through a loosely coupled, flexible mapping to existing relational schema.

.NET HITMAN: Difference between LINQ to SQL and the Entity Framework

Friday, June 27, 2008

Mark Malakanov poorly maintained blog: SSIS 2005. Fast load into non-MS OLE DB destination

Speed up SSIS to Oracle loads... without a 3rd-party component... but not quite as easily.

Great Article. This helped me speed up my Load. It is 8 times faster this way.

Mark Malakanov poorly maintained blog: SSIS 2005. Fast load into non-MS OLE DB destination

Are you only getting 1GB of RAM out of SQL? SQL Server memory configurations for procedure cache and buffer cache

One reason to switch to 64-bit SQL Server.

The 32-bit platform

The 32-bit platform (x86) has the least amount of buffer cache. Buffer cache cannot reside within the Address Windowing Extension (AWE)-controlled memory space; it has to be in the first 2 Gigs of RAM allocated to the SQL Server instance. On the 32-bit platform SQL Server 2000 and SQL Server 2005, both use the same base calculation to find the amount of procedure cache to use. SQL Server will use up to 1 GB of memory, or 50% of the memory, whichever is lower.

SQL Server memory configurations for procedure cache and buffer cache

Monday, June 23, 2008

Radim.NET - SQL SP3 TBA... in 2008?

Looks like Cumulative Update 8 just isn't cutting it.

After lot of demands from user community (https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=326575) MS finally decided to create SP3 for SQL Server 2005. It will be shipped after official launch of SQL2008, but still we should see SP3 in 2008. That's a good news, because all Cumulative Updates (new CU7 was published two days ago http://support.microsoft.com/kb/949095/en-us) were not recommended to install and SP2 brought a lot of problems with it.

Radim.NET

Wednesday, June 18, 2008

OCZ NIA setup and help thread - OCZ Forum

Some good feedback so far.... I still want one of these!

This is by far the coolest thing since sliced bread, it takes some getting used to but I am getting better fast. I was having trouble at first with moving forward in UT3 and had to ask my GURU for help. The fix was easy, I clench my teeth a lot so he told me to lower the movement to 3.0 on the joystick 1 profile and wala I am unstoppable. OCZ ROCKS. The more I play the more I see how slow my keyboard is, I had to set my mouse sensitivity up so it could keep up with the advanced profile movements. 

OCZ NIA setup and help thread - OCZ Forum

OLAP PivotTable Extensions - Home

 

OLAP PivotTable Extensions is an Excel 2007 add-in which extends the functionality of PivotTables on Analysis Services cubes. The Excel 2007 API has certain PivotTable functionality which is not exposed in the UI. OLAP PivotTable Extensions provides an interface for some of this functionality. It can be launched from the following menu option in the right-click menu for PivotTables:

OLAP PivotTable Extensions - Home

Monday, June 16, 2008

Creating Connection Managers & You may be unable to execute SQL Server 2005 Integration Services packages that contain script tasks or script components & 64 bit

Setting the Project Properties to Run64BitRuntime = false resolves this.... and while scheduling you'll need to use the x86 version of dtexec.

Both versions of the provider have the same ID. To specify whether the Integration Services runtime uses an available 64-bit version of the provider, you set the Run64BitRuntime property of the Integration Services project. If the Run64BitRuntime property is set to true, the runtime finds and uses the 64-bit provider; if Run64BitRuntime is false, the runtime finds and uses the 32-bit provider. For more information about properties you can set on Integration Services projects, see Integration Services Considerations on 64-bit Computers and Integration Services in Business Intelligence Development Studio.

Creating Connection Managers

Friday, June 13, 2008

Poor Man's Proclarity

 

Day after day we are working with Cube Browser but when the project or cube designer has closed we lost our query, sometime it takes a long time to reorder again all our dimensions.

This add-in is giving us the ability to save personal views and run it as a new request.

I develop it for SSAS 2005 & 2008 (SSAS 2008 with VS 2008).

BeI - Microsoft Business Intelligence

Sync All Logins on a Server in a single click using SP_MSForEachDB - SQL Server Central

Sync'ing logins with Log Shipping.

One of the problems restoring a database to a new server is dealing with out of sync logins. The link between a database user name and a server user name is the SID that is generated when the login is added to SQL Server. There are stored procedures to sync the SID's but they have to be run for each user that is out of sync in each database. If you are bringing up a DR server that houses 60 log shipped databases, this can be a very tedious task.

Sync All Logins on a Server in a single click using SP_MSForEachDB - SQL Server Central

Eliminating Cursors - SQL Server Central

One way to eliminate cursors scraping across your tables like fingers on a chalkboard.

 

Eliminating Cursors - SQL Server Central

Show content differences between two tables/views - SQL Server Central

Useful script.

Show content differences between two tables/views

Show content differences between two tables/views - SQL Server Central

Thursday, June 05, 2008

SharePoint Live Document Libraries

Softartisans Officewriter has some interesting products with SQL & Sharepoint integration.

Live Document Libraries

divider

SharePoint Document Libraries are a convenient and increasingly popular way to share files across an organization. SharePoint adds powerful features, such as access control and versioning, on top of basic file availability. However, Document Libraries can only serve static documents. For example, if you wanted to store a spreadsheet with sales data, you would need to constantly edit the document to insure that the employees who download the file are getting the latest data. This limitation does not allow a company to take advantage of the fact that these documents are being stored on a server with ready access to the latest corporate data.

Publish data from:

arrow
SQL Server

arrow
ADO.NET

arrow
Business Data Catalog

OfficeWriter turns SharePoint Document Libraries into Live Document Libraries, service the most current data from any ADO.NET or Business Data Catalog data source. Every time a user requests the document, you can return the latest data.

SharePoint Live Document Libraries

Tuesday, June 03, 2008

Creating a Sequential Record Number field - SQLTeam.com

When does Something = Something = Something?  Only in SQL....

This little piece of code will run through a table and sequentially number the field you specify. The only drawback is that it will determine the order based on the physical order of the table.
declare @intCounter int
set @intCounter = 0
update Yaks
SET @intCounter = YakSequenceNumber = @intCounter + 1

Creating a Sequential Record Number field - SQLTeam.com

Monday, June 02, 2008

MDX | The Frog-Blog

 

Convert MDX fields to SQL
Saturday, December 15th, 2007

A number of our customers have reporting systems that use both MDX and SQL, retrieving data from both OLAP and SQL Server databases. This generates the problem of converting an MDX field ([Dimension].[Hierarchy].&[Attribute]) into SQL Server field value (Attribute). The following code is a Reporting Services custom code section that will rip off the MDX and leave you with the value.

    Public Function MDXParamToSQL(Parameter As String, All As String) As String

        Dim Val As String
        Val = Parameter

        If Val.Contains(”[”) Then
            If Val.ToLower().Contains(”].[all]”) Then
                Return All
            Else
                Val = Val.Substring(1, Val.LastIndexOf(”]”) - 1)
                Val = Val.Substring(Val.LastIndexOf(”[”) + 1)
                Return Val
            End If
        Else
            Return Val
        End If

    End Function

MDX | The Frog-Blog

Wednesday, May 28, 2008

Chris Webb's BI Blog - Why Linq to MDX isn't worth the ROI

In my opinion, MDX is a complex query language that isn't intuitive, and most people I work with cringe when they need to write an MDX query.  Performance is unpredictable and it is really easy to shoot yourself in the foot.  Service packs with Analysis Services make a difference in both performance and results of a query.

If you disagree with the above statement, see Mosha's latest entry on Subselects, SCOPEs, and hierarchy navigation MDX functions.

With standardized T-SQL, and the query plan generator or plan explanation tools in modern databases, it is much easier to build and adjust SQL code for performance and maintainability.  SQL, though, doesn't have the time intelligence and other BI features that make Analysis Services shine.  Sure, you can hack them in there, but relational databases aren't really designed to answer the same questions as cubes.

Code developers seem to be of a different mindset than SQL DBAs.   Rather than using stored procedures, many people unfamiliar with databases prefer to use the 'dynamic SQL' approach that is causing so much of the SQL injection problems of today.  Maintaining classes with SQL strings is about as much fun as writing MDX.  If you're going to do something like that, at least put them outside your compiled assemblies.

So what's the solution for both of these?  SQL has tons of tools that remove the dynamic SQL approach from the hands of developers and put it into automated ORM generation and CRUD generation frameworks.  Tools for offline code generation, like MyGeneration and CodeSmith.  Tools for "on-the-fly" generation, like NHibernate, and LINQ.  What does MDX have?

Excel.

And LINQ to MDX still looks like it's pretty far off.

Seeing that Marco Russo has released his book "Programming Microsoft LINQ" reminded me of a conversation I had with him a while ago about something I've heard various people ask about over the last year - will there be a LINQ to MDX?

Chris Webb's BI Blog

What happened to Natural Language Query? Training queries so that Business Analysts could access their data with "friendly" terminology seemed like a good idea at the time...

Unfortunately, (or fortunately, depending on if you were the one doing the vocabulary training) it went the way of the Dodo.

This blog posting just about sums it up.

Even if I could talk to my computer (an idea that's never particularly appealed to me, this Mac is supposed to be able to do it but I've never turned it on), would I want to speak to it in full sentences stuffed with subordinate clauses and prepositional phrases? I think I'd want to grunt things like “Yahoo, Berlin weather” or “break line 238” or “spam!”.

http://www.tbray.org/ongoing/When/200x/2003/05/16/NLQuery

Grunting out a LINQ select statement.

public void Linq7() {
    List products = GetProductList();
    var productNames =
        from p in products
        select p.ProductName;
    Console.WriteLine("Product Names:");
    foreach (var productName in productNames) {
        Console.WriteLine(productName);
    }
}

Grunting out a SQL statement.

SELECT * FROM Product

Grunting out an MDX Statement

SELECT [Product].[Product].members on 0

FROM $Product

Grunting out an MS Access select statement.

Double-click on the table dummy!

I still prefer the SQL approach, since double-click doesn't seem to scale as well. :)

How about Dynamic SQL in Cobol?  It's all Portugese to me...


1 2 3 4 5 6 7
123456789012345678901234567890123456789012345678901234567890123456789012

000001*----------------- I N I C I O D O C O D I G O --------------*
000002 IDENTIFICATION DIVISION.
000003*-----------------------
000004 PROGRAM-ID. SELECT01.
000005
000006* Sistema : EXEMPLO
000007* Programa : SELECT01
000008* Objetivo : Listar os dados da CONTA corrente
000009* Analista : CARLOS ALBERTO DORNELLES
000010* Desenvolvedor: CARLOS ALBERTO DORNELLES
000011* Data : 31/12/2002
000012* Linguagem : COBOL / DB2 / CICS
000013* Manutencoes :
000014*----------------------------------------------------------------*
000015* Desenvolvedor Responsavel Data
000016* ------------- ----------- ----
000017*
000018* xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xx/xx/xxxx
000019* descrição xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
000020*----------------------------------------------------------------*
000000
000021 ENVIRONMENT DIVISION.
000022*---------------------
000023 CONFIGURATION SECTION.
000024*---------------------
000025 SPECIAL-NAMES.
000026 DECIMAL-POINT IS COMMA.
000027
000028 DATA DIVISION.
000029*-------------
000030 WORKING-STORAGE SECTION.
000031*-----------------------
000032 77 WS-SQLCODE-EDT PIC ----9.
000033 01 AREAS-DE-TRABALHO.
000034 03 WS-TAM PIC 9(005).
000039 01 WS-VARIAVEIS-DB2.
000040 03 WS-GR-CURSOR.
000041 49 WS-ID-TAMANHO-CURSOR PIC S9(004) COMP VALUE ZEROES.
000042 49 WS-DE-CURSOR PIC X(2000) VALUE SPACES.
000035 01 WS-AREA-ENTRADA.
000039 05 PRM-NU-CONTA-E PIC 9(004).
000035 01 WS-AREA-SAIDA.
000036 03 PRM-QTDE-CONTA PIC 9(004).
000037 03 PRM-ARRAY-SAIDA OCCURS 1 TO 100 TIMES
000038 DEPENDING ON PRM-QTDE-CONTA.
000039 05 PRM-NU-CONTA PIC 9(004).
000040 05 PRM-NO-CONTA PIC X(040).
000040 05 PRM-NO-ENDERECO PIC X(070).
000040 05 PRM-NO-CIDADE PIC X(050).
000039 01 WS-AREA-ERROS.
000040 03 PRM-QTDE-ERROS PIC 9(003).
000041 03 PRM-ARRAY-ERROS OCCURS 1 TO 094 TIMES
000042 DEPENDING ON PRM-QTDE-ERROS.
000043 05 PRM-NUMERO-MENSAGEM PIC X(004).
000044 05 PRM-PROGRAMA PIC X(008).
000045 05 PRM-INFORMACOES PIC X(200).
000046
000047* Definicao de tabelas e areas na DCLGEN *
000048*----------------------------------------------------------------*
000049 EXEC SQL INCLUDE SQLCA END-EXEC.
000050 EXEC SQL INCLUDE TABELA01 END-EXEC.
000051
000052 LINKAGE SECTION.
000053*---------------
000054 01 DFHCOMMAREA.
000055 03 LKS-EXCECAO.
000056 05 LKS-ERRO-CICS PIC 9(003).
000057 05 LKS-NU-MENSAGEM PIC 9(004).
000058 05 LKS-NO-MENSAGEM PIC X(078).
000059 05 LKS-NU-SQLCODE PIC 9(004).
000060 03 LKS-IDENTIFICACAO.
000061 05 LKS-IN-NOME-PGM PIC X(008).
000062 05 LKS-IN-CO-USUARIO PIC X(008).
000063 05 LKS-IN-CO-FUNCAO PIC X(002).
000064 03 LKS-ENTRADA-SAIDA.
000065 05 LKS-CONTEUDO-TAM PIC 9(005).
000066 05 LKS-CONTEUDO.
000067 07 FILLER PIC X(001) OCCURS 1 TO 20000
000068 DEPENDING ON LKS-CONTEUDO-TAM.
000069
000070 PROCEDURE DIVISION USING DFHCOMMAREA.
000071*------------------------------------
000000
000072 PERFORM R000-PROCED-INICIAIS THRU R000-FIM.
000073 PERFORM R100-PROCED-PRINCIPAIS THRU R100-FIM.
000074 PERFORM R999-PROCEDIMENTOS-FINAIS THRU P999-FIM.
000075
000076 R000-PROCED-INICIAIS.
000077*--------------------
000000
000105 MOVE LK-CONTEUDO(1:LK-CONTEUDO-TAM) TO WS-AREA-ENTRADA.
000078 INITIALIZE LKS-EXCECAO.
000079 MOVE SPACES TO LKS-CONTEUDO(1:20000).
000080 MOVE ZEROES TO LKS-CONTEUDO-TAM
000081 PRM-QTDE-CONTA
000082 PRM-QTDE-ERROS.
000083 R000-FIM.
000084 EXIT.
000085
000086 R100-PROCED-PRINCIPAIS.
000087*----------------------
000000
000088 PERFORM R200-ABRE-CONTA THRU R200-FIM.
000089 PERFORM R210-LE-CONTA THRU R210-FIM.
000090 IF SQLCODE EQUAL +100
000091 MOVE 1 TO LKS-ERRO-CICS
000092 ADD 1 TO PRM-QTDE-ERROS
000093 MOVE SPACES TO PRM-INFORMACOES (PRM-QTDE-ERROS)
000094 MOVE SQLCODE TO LKS-NU-SQLCODE
000095 MOVE SQLCODE TO WS-SQLCODE-EDT
000096 STRING 'Nenhum registro encontrado na tabela TABELA01.'
000102 DELIMITED BY SIZE
000103 INTO PRM-INFORMACOES (PRM-QTDE-ERROS)
END-STRING
000104 MOVE '0001' TO PRM-NUMERO-MENSAGEM (PRM-QTDE-ERROS)
000105 MOVE 'SELECT01' TO PRM-PROGRAMA (PRM-QTDE-ERROS)
000106 PERFORM R999-PROCEDIMENTOS-FINAIS
000107 END-IF.
000108 PERFORM UNTIL SQLCODE = +100
000109 PERFORM R220-MONTA-CONTA THRU R220-FIM
000110 PERFORM R210-LE-CONTA THRU R210-FIM
000111 IF PRM-QTDE-CONTA = 100
000112 MOVE +100 TO SQLCODE
000113 END-IF
000114 END-PERFORM.
000115 PERFORM R230-FECHA-CONTA THRU R230-FIM.
000116 MOVE LENGTH OF WS-AREA-SAIDA TO LKS-CONTEUDO-TAM.
000118 MOVE WS-AREA-SAIDA TO LKS-CONTEUDO (1:LKS-CONTEUDO-TAM).
000119
000120 R100-FIM.
000121 EXIT.
000122
000123 R200-ABRE-CONTA.
000124*---------------
000000
000136 INITIALIZE WS-GR-CURSOR.
000137 MOVE 1 TO WS-ID-TAMANHO-CURSOR.
000000 MOVE PRM-NU-CONTA-E TO NU-CONTA.
000138
000139 STRING
000140 'SELECT NU_CONTA , NO_CONTA , NO_ENDERECO , NO_CIDADE '
000000 'FROM DCL.TABELA01_CONTA '
000141 DELIMITED BY SIZE INTO WS-DE-CURSOR
000142 WITH POINTER WS-ID-TAMANHO-CURSOR
000000 END-STRING.
000000
000000 IF NU-CONTA NOT EQUAL ZEROES
000139 STRING
000140 'WHERE NU_CONTA >= ' :NU-CONTA
000141 DELIMITED BY SIZE INTO WS-DE-CURSOR
000142 WITH POINTER WS-ID-TAMANHO-CURSOR
000000 END-STRING
000000 END-IF.
000000
000225 EXEC SQL
000226 PREPARE CONSULTA FROM :WS-GR-CURSOR
000227 END-EXEC.
000228
000229 IF SQLCODE NOT EQUAL +0
000230 MOVE 1 TO LK-ERRO-CICS
000231 MOVE SQLCODE TO LK-NU-SQLCODE
000232 PERFORM R999-PROCEDIMENTOS-FINAIS
000233 END-IF.
000234
000235 EXEC SQL
000236 DECLARE CUR001 CURSOR FOR CONSULTA
000237 END-EXEC.
000238
000239 IF SQLCODE NOT EQUAL +0
000240 MOVE 1 TO LK-ERRO-CICS
000241 MOVE SQLCODE TO LK-NU-SQLCODE
000242 PERFORM R999-PROCEDIMENTOS-FINAIS
000243 END-IF
000244
000245 EXEC SQL
000246 OPEN CUR001
000247 END-EXEC.
000248
000133 IF SQLCODE NOT EQUAL +0
000134 MOVE 1 TO LKS-ERRO-CICS
000135 ADD 1 TO PRM-QTDE-ERROS
000136 MOVE SPACES TO PRM-INFORMACOES (PRM-QTDE-ERROS)
000137 MOVE SQLCODE TO LKS-NU-SQLCODE
000138 MOVE SQLCODE TO WS-SQLCODE-EDT
000139 STRING 'Erro de acesso a base de dados. SQLCODE: '
000140 WS-SQLCODE-EDT ' ErrMc: ' SQLERRMC
000143 ' - Tabela utilizada -> TABELA01'
000145 DELIMITED BY SIZE
000146 INTO PRM-INFORMACOES (PRM-QTDE-ERROS)
000147 MOVE '0001' TO PRM-NUMERO-MENSAGEM (PRM-QTDE-ERROS)
000148 MOVE 'SELECT01' TO PRM-PROGRAMA (PRM-QTDE-ERROS)
000149 PERFORM R999-PROCEDIMENTOS-FINAIS
END-STRING
000150 END-IF.
000000
000151 R200-FIM.
000152 EXIT.
000153
000154 R210-LE-CONTA.
000155*-------------
000000
000156 EXEC SQL
000157 FETCH CUR001
000158 INTO :NU-CONTA
000159 , :NO-CONTA
000159 , :NO-ENDERECO
000159 , :NO-CIDADE
000160 END-EXEC.
000000
000161 IF SQLCODE NOT EQUAL +0 AND +100
000162 MOVE 1 TO LKS-ERRO-CICS
000163 ADD 1 TO PRM-QTDE-ERROS
000164 MOVE SPACES TO PRM-INFORMACOES (PRM-QTDE-ERROS)
000165 MOVE SQLCODE TO LKS-NU-SQLCODE
000166 MOVE SQLCODE TO WS-SQLCODE-EDT
000167 STRING 'Erro de acesso a base. SQLCODE: '
000168 WS-SQLCODE-EDT ' ErrMc: ' SQLERRMC
000171 ' - Tabela utilizada -> TABELA01'
000173 DELIMITED BY SIZE
000174 INTO PRM-INFORMACOES (PRM-QTDE-ERROS)
END-STRING
000175 MOVE '0002' TO PRM-NUMERO-MENSAGEM (PRM-QTDE-ERROS)
000176 MOVE 'SELECT01' TO PRM-PROGRAMA (PRM-QTDE-ERROS)
000177 PERFORM R230-FECHA-CONTA THRU R230-FIM
000178 PERFORM R999-PROCEDIMENTOS-FINAIS
000179 END-IF.
000000
000180 R210-FIM.
000181 EXIT.
000182
000183 R220-MONTA-CONTA.
000184*----------------
000000
000185 ADD 1 TO PRM-QTDE-CONTA.
000186 MOVE NU-CONTA TO PRM-NU-CONTA (PRM-QTDE-CONTA).
000187 MOVE NO-CONTA TO PRM-NO-CONTA (PRM-QTDE-CONTA).
000186 MOVE NO-ENDERECO TO PRM-NO-ENDERECO (PRM-QTDE-CONTA).
000187 MOVE NO-CIDADE TO PRM-NO-CIDADE (PRM-QTDE-CONTA).
000000
000188 R220-FIM.
000189 EXIT.
000190
000191 R230-FECHA-CONTA.
000192*----------------
000000
000193 EXEC SQL
000194 CLOSE CUR001
000195 END-EXEC.
000000
000196 R230-FIM.
000197 EXIT.
000198
000199 R999-PROCEDIMENTOS-FINAIS.
000200*-------------------------
000000
000201 IF LKS-ERRO-CICS = 1
000202 MOVE LENGTH OF WS-AREA-ERROS TO LKS-CONTEUDO-TAM
000203 MOVE WS-AREA-ERROS TO LKS-CONTEUDO (1:LKS-CONTEUDO-TAM)
000205 END-IF.
000206 EXEC CICS
000207 RETURN
000208 END-EXEC.
000000
000209 P999-FIM.
000210 EXIT.
000211*----------------- F I M D O C O D I G O --------------------*
 

Sunday, May 25, 2008

Microsoft Dynamics CRM UK Blog : Resizing A Virtual PC Hard Drive

 

Resizing A Virtual PC Hard Drive

Holy Diver...

The other day I was working on one of my Virtual PC demo images, when I noticed I was running out of disk space. When I originally created the Virtual Hard Drive (.VHD) I just accepted the default size of 16GB without thinking, but more and more often I find I need to install other products such as SharePoint Server, BizTalk Server, PerformancePoint Server, which inevitably require extra disk space.

Microsoft Dynamics CRM UK Blog : Resizing A Virtual PC Hard Drive

Friday, May 23, 2008

SQL Excel freeware add-in - Home

SQL Excel is just that, a simpler and easier way to get SQL results into Excel directly from SQL.

Seems really promising...

May 21st - new much improved version is available (compatible and tested on Excel 2000, 2002/XP, 2003 and 2007).    This is an Excel for Windows add-in so it wont work on a mac

SQL Excel freeware add-in - Home

Thursday, May 22, 2008

Windows XP (SP2): 3 ways to optimize performance with NTFS

Could be useful for optimizing SQL bootup times.  Note that a large number of databases will also increase bootup times... be sure to detach databases not in use and keep sizes as small as possible.

Microsoft Bootvis is a good tool for troubleshooting bootup times.

Resize the Master File Table and prevent fragmentation
The Master File Table (MFT) contains specific information about each folder and file on your hard disk (such as date of creation, parameters etc.). To prevent fragmentation, the NTFS reserves exactly 12.5% of your hard disk capacity for the MFT. However, when your free disk space is low, XP writes those files directly into the MFT. Additionally, small files are automatically stored in the MFT. Both factors lead to a certain degree of fragmentation which is why we recommend to increase the MFT:

Windows XP (SP2): 3 ways to optimize performance with NTFS

Quick and Dirty SSIS Variable Export

If you have a lot of variables in your SSIS package and you want to document the contents, one way is to do this:

1. Create a package configuration

2. Enter a name for the config file (variables.xml)

3. Select the variables to include.

4. Click OK to create the config file.

This XML can then be opened in Excel 2007 as an XML table.

Passing Parameters as (almost) 1, 2, and 3 Dimensional Arrays - SQL Server Central

Another few uses for the numbers table, and a new SQL 2005 CTE example without a numbers table.
http://www.sqlservercentral.com/articles/T-SQL/63003/

Friday, May 16, 2008

SSIS Trick - Setting multiple variables at once

There are custom components out there that set a single variable for you.  You can also set variables using script tasks. 

One way I found to set multiple variables in a package at the same time is to execute a 'fake' sql command. 

There is a tiny performance hit, however this could also be considered a way to include 'profiling' of your app variables with SQL Profiler.

1. Drag a SQL Command Task into the package.
2. Set the command connection.  Set the command text to SELECT 'Myvalue' as MyVariableValue, 'myvalue2' as My2ndVariableValue

Notice no FROM statement.  This also works for other databases, using DUMMY tables.
3. Set the resultset to 'Single Resultset'
4. Set the Results tab to map the variables to the select statement results.

Tuesday, May 13, 2008

Thursday, May 08, 2008

Kimberly L. Tripp: Improving *my* SQL skills through your questions! http://www.SQLskills.com/blogs/kimberly

 

If you add more than 1GB then you'll add 16VLFs. In general, most transaction logs will only have 20 or 30 VLFs - even 50 could be reasonable depending on the total size of the transaction log. However, in many cases what happens is that excessive autogrowths can cause an excessive number of VLFs to be added - sometimes resulting in hundreds of VLFs. Having an excessive number of VLFs can negatively impact all transaction log related activities and you may even see degradation in performance when transaction log backups occur. To see how many VLFs you have solely look at the number of rows returned by DBCC LOGINFO. The number of rows returned equals the number of VLFs your transaction log file has. If you have more than 50, I would recommend fixing it and adjusting your autogrowth so that it doesn't occur as fequently. To get rid of all of the execessive VLFs, follow these easy steps to shrink off the fragmented chunk and add a new, clean chunk to your transaction log:

Kimberly L. Tripp: Improving *my* SQL skills through your questions! http://www.SQLskills.com/blogs/kimberly

Wednesday, May 07, 2008

Andy Leonard : SSIS Design Pattern - Incremental Loads

Incremental loads without a CDC tool.

SSIS Design Pattern - Incremental Loads

Introduction

Loading data from a data source to SQL Server is a common task. It's used in Data Warehousing, but increasingly data is being staged in SQL Server for non-Business-Intelligence purposes.

Andy Leonard : SSIS Design Pattern - Incremental Loads

Steve Fibich : Passing a values back from a child package to a parent package in SSIS

 

I found this process very useful to pass metadata about versions of data imported into a master data management system from a child package back to a parent package.  You can pass any data types from a child to a parent using this method.  Normally I put the script that passes the value from the child to parent package in the post execute event handler.  The only reason I put the task in the event handler is for style, as I feel it’s better to put this variable handling code separate from the specific package logic itself.

Steve Fibich : Passing a values back from a child package to a parent package in SSIS

Andy Leonard : SSIS Design Pattern - Read a DataSet From Variable In a Script Task

Andy has more SSIS goodness.

This script uses an OLEDbDataAdapter (oleDA) to fill a DataTable (dt) with the contents of the dsVar SSIS package variable, then iterates each row and column to build a string containing the data in the row. It then pops up a messagebox for each row displaying the row's contents before moving to the next row.

Andy Leonard : SSIS Design Pattern - Read a DataSet From Variable In a Script Task

Andy Leonard : Introducing Change Data Capture, SSIS, and SQL Server 2008 CTP5 (Nov 2007)


I'm currently working with an AS/400-based CDC system.  MS has jumped into the pond with built-in CDC in 2008.

Introducing Change Data Capture, SSIS, and SQL Server 2008 CTP5 (Nov 2007)

Introduction

On Thursday, 24 Jan 2008, I presented New Features In SSIS 2008 to the Richmond SQL Server Users Group.

Most of the presentation was dedicated to demonstrating Change Data Capture (CDC) interacting with SQL Server 2008 Integration Services. I started seriously working on this demo the first week of January, thinking I'd put 2 - 6 hours into it to get it running using the detailed instructions in Books Online. Things were going relatively well working through the demo until I hit calls from SSIS to table-valued functions created by CDC.

Andy Leonard : Introducing Change Data Capture, SSIS, and SQL Server 2008 CTP5 (Nov 2007)

Thursday, May 01, 2008

Multiple NULL values in a Unique index in SQL Server/DB2 LUW « Systems Engineering and RDBMS

 

Yesterday, when helping out a friend who was working on a project that required porting an application from Oracle v9.2.0.5 to SQL Server 2005, he ran into the same UNIQUE index issue as we had blogged before. Since that was a major requirement by the client, this project needed to support having multiple NULL values in the column and still have a UNIQUE constraint. That is allowed by Oracle but not in SQL Server and DB2 LUW. There is a way to make this work in SQL Server and DB2 LUW also but that requires a work-around. Consider this table:

Multiple NULL values in a Unique index in SQL Server/DB2 LUW « Systems Engineering and RDBMS

Wednesday, April 30, 2008

A Function Gotcha with the Use of an Asterisk - SQL Server Central

Excel is my favourite tool for LD (Lazy Development).

Here's an interesting quirk that functions in SQL have when using Select *, and a workaround using Excel as a performance accelerator for development.

During a recent upgrade of our software, I discovered what I assume is a little-known gotcha that I feel appropriate to document and pass on. The gotcha occurs with user-defined table functions (UDFs), when selecting columns from a table using the asterisk (select all) method. The problem then occurs only when columns are subsequently added or removed from the based over table without recreating the function. When these conditions occur, it results in interesting and undesirable output. The SQL below illustrates this problem using SQL 2000.

A Function Gotcha with the Use of an Asterisk - SQL Server Central

One of the best features in Excel 2007 for SQL DBAs is the Conditional Format - Highlight Duplicates.  By using this, the tedious task of writing duplicate-finding sprocs is replaced with cut-paste-Conditional Format.

Now if only there was a data entry tool directly into SQL for Excel besides PerformancePoint.

Wednesday, April 23, 2008

Snapshots of Life, Faith and Work.: Custom SSIS Slowly Changing Dimension Type 2

 

Unfortunately when you use the SCD wizard to create a type 2 slowly changing dimension you have to choose between using a current indicator or a valid date range technique. You can not have both, at least through the wizard. To add both you will have to edit the package after the wizard is complete.

Complete the Slowly Changing Dimension wizard. I prefer choosing the Single Column / Current Flag option for Historic Attribute Changes during the wizard.

Snapshots of Life, Faith and Work.: Custom SSIS Slowly Changing Dimension Type 2

SqlBI.eu - Tabledifference SSIS component

 

Table difference is an SSIS custom component designed to simplify the management of slowly changing dimensions and – in general – to check the differences between two tables or data flow with SSIS.

Its main advantage over Microsoft standard SCD component is its speed and ease of use, the component receives input from two sorted sources and generates different outputs for unchanged, new, deleted or updated rows.

The project is freeware, full source code is available.

SqlBI.eu

Friday, April 18, 2008

Peter Eb on Custom Number formats in Excel (and this works in Reporting Services too!)

This saves so much hassle when dealing with $K or $M, or even $B values.

HOWTO: Show numbers as 1,000s in Excel

Posted Thursday, April 17, 2008 6:00 PM by petereb

This time there's nothing really specific about PPS. It's more of an Excel post actually... 

I've seen this a few times. Sometimes the data form authors want to show is big, and they want to show 1 instead of 1000 or 1 instead of 1000000. There are a bunch of complicated games you an play with formulas and rounding to get close to this behavior. But in this case you shouldn't settle for close. This is bizarrely not explicitly shown in the Excel UI, but this is well supported by the custom number format functionality. You just use a custom number format:

in thousands: #,

in millions: #,,

NumberFormatI1000s

Not sure off hand what to do in other regional settings. You may still have to use a comma "," or you might need to use the decimal separator "." or whatever it is called in your culture... In my test the number format works well:

ShowIn1000s

Although I agree formatting a matrix properly is a little tricky until you get the hang of it, unfortunately this is a short post and I'll save larger formatting discussions for another post. For data entry into cells with this formatting, you still type the entire number. If you want to avoid that part too then I suggest doing that conversion in the fact table to begin with...

Peter Eb.

Wednesday, April 16, 2008

SQL Server And XML: How to find all stored procedures used by Report Server?

 

How to find all stored procedures used by Report Server?

Report definitions [RDL files] are stored in the "catalog" table of ReportServer database. This table has a field "content" which stores the report definition as an image/text value.

The following query will extract a list of all reports and the stored procedures used by them, by querying the catalog table of report server.

SQL Server And XML: How to find all stored procedures used by Report Server?

SOA Challenges: Entity Aggregation

When building a Service Oriented Architecture, a Canonical Schema is important. 

Further details in this article from 2004.

Schema Reconciliation

Not only do disparate services have different views of an entity, they may also have their own schematic representation of their views. In order to achieve a single unified view of an entity, it is imperative for the EA service to harmonize the schematic differences between different services. To do this, the EA service should first know how each service represents an entity. Additionally, the EA service should define a holistic view of the entity by logically consolidating the various views. Equally important is for the EA service to discover a way to represent the transformation between a service's view of an entity and the holistic view. The following figure shows the customer information represented in more than one service.

SOA Challenges: Entity Aggregation

SQL Scripter

Generate T-SQL Data Scripts


SQL Scripter is a powerful tool for SQL Server 7.0/2000/2005 database administrators and developers
to generate data scripts in a readable and executable T-SQL format.

SQL Scripter

Build a Metadata-Driven ETL Platform by Extending Microsoft SQL Server Integration Services

SQL 2008 Metadata-Driven ETL Whitepaper.

Platform Architecture

The design goals of the platform include improving the productivity of developers, enforcing ETL standards, supporting a cost-effective way to deploy large data warehouses on commodity hardware, and providing a centralize metadata repository for lineage tracking. The solution architecture of the platform is shown in Figure 1. The intent of this paper is not to document all the implementation details. Rather, it describes the concepts and key components of the platform and how they are connected with SQL Server Integration Services. For a more detailed architecture diagram, see Figure 6 at the end of this paper.

ETLExtendSSISFig1.gif

Build a Metadata-Driven ETL Platform by Extending Microsoft SQL Server Integration Services

10 Easy Steps to Beautiful Sql Code

Note: Shortly after I put this article together, I realized that someone else wrote something eerily similar, so I decided not to submit as an article to SQL Server Central or another content aggregator. 

Also, the web service I was using stopped working a couple days after I wrote this.  :(

Anyway, this should offer a quick and easy guide to setting up a CLR web service call from SQL Server.  Just don't bother using the web service I'm providing as an example.

 

This project uses a SQL Server Common-Language Runtime (CLR) Function which calls a 3rd-party Web Service to format and beautify SQL Server Stored Procedures directly from Query Analyzer. Beautiful code is usually easier to read and allows for easier maintainability.

What do I need?

I am using Microsoft SQL Server 2008 CTP 6 for this example, however it should be backwards compatible with SQL Server 2005. I also have Visual Studio 2005 installed.

Alternatives to this method include SQL Pretty Printer http://www.sqlparser.com/ plugin for Visual Studio.

Disclaimer

I do not recommend using this in a production environment or with confidential stored procedures as it calls a web service and opens the database up to potentially malicious calls. You may need to change the locations where files and databases are created. Use at your own risk.

For this demo, you will need to enable the CLR in SQL Server.

Steps to Implement a CLR in SQL Server

From SQL Server Management Studio, Query Analyzer

--Execute this statement

EXEC sp_configure 'clr enabled', 1;

RECONFIGURE WITH OVERRIDE;

GO

When sending results to text, you may need to set the "Maximum number of characters displayed in each column" property of SQL Management Studio - Query Analyzer to a higher value than the default of 256. I have this set to 8000, but for larger stored procedures you may require more. Better yet, send the results to a file.

clip_image001

From the Visual Studio Command Prompt

Begin by creating the C# class library required for the solution. You may want to use NAnt, MSBuild, Visual Studio or a batch file to automate these tasks.

Step 1: Create the "wiz-dal" (WSDL) class wrapper for the Web Service

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl /o:SqlFormatterWebService.cs /n:SqlFormatterWebService.

Step 2: Create the sqlformat.cs class

Open up Notepad and save this as the following file:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sqlformat.cs

using System; 
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using SqlFormatterWebService.Test;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlFunction]
public static string FormatSql([SqlFacet(MaxSize=-1)]SqlString inputsql)
{
return GetFormattedSql(inputsql.ToString());
}
public static string GetFormattedSql(string inputsql)
{
SQLFormatterWebService sqlformatter = new SQLFormatterWebService();
return sqlformatter.beautifySql("tester","mssql","sql",inputsql,"");
}
};

Step 3: Execute the following from the Visual Studio Command Prompt:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\csc /t:library sqlformat.cs sqlformatterwebservice.cs

Once the class library is created, the sqlformat.dll file will be available to add as an assembly reference in SQL Server.

From Sql Management Studio - Query Analyzer

Step 4: Create a database to store the CLR function (optional)

CREATE DATABASE [ClrWebServices] ON PRIMARY 
( NAME = N'ClrWebServices', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\ClrWebServices.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'ClrWebServices_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\ClrWebServices_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

Step 5: Change the database owner to a non-domain service account (optional)

sp_changedbowner 'localhostname\localserviceuser

Step 6: Set database as trustworthy

There are many reasons why you would not do this in a production environment. Alternatives are in this forum posting:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2027982&SiteID=1

USE ClrWebServices 
GO
ALTER DATABASE ClrWebServices SET TRUSTWORTHY ON
Step 7: Create the assembly reference for the function
CREATE ASSEMBLY SqlFormat
FROM 'C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sqlformat.dll'
WITH PERMISSION_SET = UNSAFE;
GO

Step 8: Create the assembly reference for the function serializer

The XML Serializer is required when using a Web Service in CLR code.

CREATE ASSEMBLY [SqlFormat.XmlSerializers] FROM 'C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sqlformat.XmlSerializers.dll' WITH PERMISSION_SET = SAFE; GO 

Step 9: Create the SQL function wrapper

CREATE FUNCTION SqlFormat(@inputSql nvarchar(max)) 
RETURNS nvarchar(max)
AS
EXTERNAL NAME SqlFormat.StoredProcedures.FormatSql
GO

Step 10: Test the procedure against a single stored procedure

Use AdventureWorks 
Go
set nocount on
go
select ClrWebServices.dbo.SqlFormat(text)
from sysobjects o
inner join syscomments c on c.id = O.id
where xtype='P'
and name = 'uspGetEmployeeManagers'

 


 


Conclusion

This article demonstrates one way of calling a web service from a CLR stored procedure, and how a web service may improve and extend the objects created inside SQL Server.

 

References:

http://en.wikipedia.org/wiki/Web_Services_Description_Language

http://en.wikipedia.org/wiki/Common_Language_Runtime\

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2027982&SiteID=1

http://support.microsoft.com/kb/913668

http://www.setfocus.com/technicalarticles/clrfunctionforsqlserver.aspx

http://sqlblogcasts.com/blogs/simons/archive/2006/11/28/CREATE-ASSEMBLY-Permissions---Could-not-obtain-information-about-Windows-NT-group-user-.aspx

http://sachabarber.net/?p=69

http://www.sqlteam.com/article/writing-clr-stored-procedures-in-charp-introduction-to-charp-part-1

http://www.sqlteam.com/article/writing-clr-stored-procedures-in-charp-returning-data-part-2

http://davidhayden.com/blog/dave/archive/2006/04/25/2924.aspx