Blog Home  Home Feed your aggregator (RSS 2.0)  
Implements IVillage - Wednesday, October 07, 2009
It takes a village to keep up with .Net
 
 Monday, October 05, 2009

SQLSaturday is a training event for SQL Server professionals and those wanting to learn about SQL Server. This event will be held October 17, 2009 at Seminole Community College, 100 Weldon Boulevard, Sanford, FL 32773. Admittance to this event is free, but to to the challenging nature of fund raising this year there will be a $10 fee due at registration to cover the cost of lunch (a great boxed lunch from Jason's Deli). All other costs are covered by donations and sponsorships. Please register soon as seating is limited, and let friends and colleages know about the event.

More Info: http://www.sqlsaturday.com/eventhome.aspx?eventid=32

Monday, October 05, 2009 8:02:16 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]    |  |   | 
 Thursday, August 06, 2009

This is impossible.  Don't try.  There are a few 'hacky' ways to do this, but why? It can be doneif you slightly modify the requirement. If you can abandon the use of a stored procedure for a User Defined Function, you can use an Inline Table-Value User-Defined Function. This is essentially a stored proc (will take parameters) that returns a table as a result set; and therefore will place nicely with an INTO statement. Here's a good quick article on it and other user defiend functions. If you still have a driving need for a Stored Procedure, you can wrap the Inline Table-Value User-Defined Function with a stored procedure. The stored proc just passes parameters when it calls select * from the Inline Table-Value User-Defined Function.

So for instance, you'd have a Inline Table-Value User-Defined Function to get a list of customers for a particular region:

CREATE FUNCTION ufCustomersByRegion (@RegionID int)

RETURNS TABLE

AS

RETURN SELECT * FROM customers WHERE RegionID = @RegionIDGO


You can then call this function to get what your results a such:

SELECT * FROM CustomersbyRegion(1)

Or to do a SELECT INTO:

SELECT * INTO CustList FROM CustomersbyRegion(1)

If you still need a stored proc, then wrap the function as such:

CREATE PROCEDURE uspCustomersByRegion

@regionID int

AS

BEGIN

SELECT * FROM CustomersbyRegion(@regionID);

END

GO

I think this is the most 'hack-less' method to obtain the desired results. It uses the existing features as they were intended to be used without additional complications. By nesting the Inline Table-Value User-Defined Function in the stored proc, you have access to the functionality in two ways. Plus! You have only one point of maintenance for the actual SQL code.

Thursday, August 06, 2009 8:37:07 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]    | 
 Saturday, July 18, 2009

Just a quick note on a small Codeplex project I am starting.  After having done some BizTalk RFID work, I found the supplied code sample for a duplicate eliminator to be an excellent example of a custom event handler, but a poor implementation of a duplicate tag eliminator.  This codeplex project is a little better thought out dupicate tag eliminator with a few added features.

Go take a look if interested and let me know what you think:  BizTalk RFID Better Duplicate Tag Eliminator

Sunday, July 19, 2009 12:24:13 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]    | 
 Tuesday, May 05, 2009

So we've been being pestered by our DBAs (you know the ones) to move our BizTalk Server 2006's Data Tier from our aging SQL Server 2000 Cluster to our new shiny SQL Server 2005 Cluster.  The end of our fiscal year was approaching so we brought in a consultant to help us. I highly recommend Catapult Systems if you need any BizTalk help. They're smart guys and have reasonable rates (in comparison to Oracle, who doesn't?).  We met with our consultant Mark and gave him the tour of our environment and he came back a week later with a solid procedure... BAM, MsgBox, WSS, Jobs, DBs... all of it.  We executed the procedure along with enough red lines to maintain their human status.  All seemed to go well - hosts started, jobs started, Group Hub back up, but wait!  Couple of jobs are failing?  Hmmm.  Update some physical paths in the backup job and all is well.  Wait. Tracked Message Copy keeps failing: 

Executed as user: HARRIS\MLBSQLVLM1. Could not find server 'mlbxxx\sql3' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. [SQLSTATE 42000] (Error 7202).  The step failed.

Now this is very confusing.  We're all on one server.  No need for any linked servers.  Why does it think mlbxxx\sql3 is a linked server it can't connect with.  Is it a permission issue?  I checked and double checked the database configuration from the old server and nothing jumped out at me.  OK.  Time to step into the deep dark reaches of the BizTalk stored procedures... the starting point: bts_CopyTrackedMessagesToDTA at line 70:

exec ('INSERT INTO [' + @dtaDbServer + '].[' + @dtaDbName + '].[dbo].[Tracking_Parts1](uidMessageID, nvcPartName, uidPartID, uidOldPartID, nNumFragments, imgPart, imgPropBag)
SELECT TOP '
+ @nTotalNumParts + ' mp.uidMessageID, mp.nvcPartName, mp.uidNewPartID, mp.uidOldPartID, p.nNumFragments, p.imgPart, p.imgPropBag
FROM (SELECT TOP 50 uidMessageID, nID FROM TrackingMessageReferences WITH (ROWLOCK INDEX(IX_TrackingMessageReferences)) ORDER BY nID ASC) as t
INNER LOOP JOIN #TrkMsgNewPartIDs mp WITH (ROWLOCK) ON t.uidMessageID = mp.uidMessageID
INNER LOOP JOIN Parts p WITH (ROWLOCK INDEX(IX_Parts)) ON mp.uidOldPartID = p.uidPartID
OPTION (KEEPFIXED PLAN)'
)

The thing that jumped out at me was the use of the full 4 part reference to the TrackingParts1 table.  This should be extra clear.  There should be no confusion.  Let me look in sys.server... it's wrong... it has MLBYYY\sql3.  How could this be... how can I ask the server it's name:

select SERVERPROPERTY('servername'); returns mlbxxx\sql3. correct. strange.

Is there another way?  Yes.

select @@servername; return mlbyyy\sql3 - wrong.  It thinks it has two names?

The detail here is how each command gets the name.  The SERVERPROPERTY comes from the Windows OS.  @@servername is the name set during installation.  I am guessing the SQL Server was built from an image and the @@servername was never adjusted when the machine was renamed.  So why didn't my query work?  It appears that when you specify the full four part name of a table, it goes to sys.servers to find out about the specified server.  If you don't specify a server (less than full 4 part naming), it bypasses sys.servers and assumes local or gets the name from the SERVERPROPERTY.

The fix:

sp_dropserver <mlbyyywhatever was returned by @@servername>;
go;
sp_addserver 'mlbxxx\sql3', local;
go

then restart the server or instance. See the KB article for the gory details.  Once this was corrected, everything worked like a charm.

 

Wednesday, May 06, 2009 12:40:45 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1]    | 
 Sunday, April 19, 2009

Back in early 2002, my company sponsored a bunch of it's developers to get their MCSDs.  These were the days of VB6 and COM+.  After many evenings at a local college and 4 certification tests - we were MCSDs.  PrimMarily a web developer, I didn't get to put much of the COM+ to use, but the SQL Server 2000 Design & Implementation class proved extremely useful.  With my newly minted MCP & MCSD next to my name, I set out to upgrade my career.  Two of my next three jobs were made possible by interviewers who noted my credentials.  Although the credentials didn't get me the job, they got my resume the leg up it needed to get in the door.  For this, I am always grateful for having done the certification.

Over the following years, I passed the .Net solutions architechture certification but didn't do much after this.  Come 2007, I began wokring with BizTalk Server 2006.  Now anyone who has worked with this product knows it is huge.  There are numerous parts to this technology stack and each more complex than the next.  After some training and a book, we were off developing solutions.  I got the opportunity to attend Teched 2008 Developer in Orlando last year and used some of my down time to pass the Biztalk certification test.  I spent many hours in the lab doing test prep and reviewing the online test guide with some books.  I managed to pass on the first try despite the ridiculous number of social events I felt compelled to attend.  Returning to work I not only had a deeper knowledge for the core BizTalk development I was doing, but I also had a stronger understanding of the entire stack from BAM to BAS but also BRE and a few key points about orchestrations that always eluded me.

I am now sadly looking at my VB6 era MCSD and hoping to upgrade it.  I've used the online planner and have a good feel for what I need to do to reach MCPD - lots more tests.  The study room and being locked away from work at a conference center helps get things moving faster.  So regardless of wether I get to join the Bus, more certifications and visits to MS learning are in my future.  They have proven their worth to me both in job seeking and comprehensive study of the technology.

PS - Anybody reading this who doesn't know about the Get On The Bus Contest - Go here: http://blogs.technet.com/mslcommunity/archive/2009/04/09/another-chance-to-get-on-the-bus-or-fly-directly-to-teched.aspx

Monday, April 20, 2009 6:38:24 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]    |  |   | 
 Tuesday, April 07, 2009

Event Description: Steve Smith Microsoft MVP in Asp.Net and Regional Director will be speaking about Asp.Net MVC and Solid Coding principles

Event Time: 4/15/2009 6:30 PM to 4/15/2009 8:00 PM (GMT-5: Eastern Time US & Canada)

Event Location: Space Coast Credit Union Headquarters 8045 N. Wickham Road, Melbourne, Florida, 32940, UNITED STATES

Register: http://www.ugss.codezone.com/UGEventView.CodezoneCom?EventID=6483

Tuesday, April 07, 2009 8:02:22 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]    | 
Copyright © 2010 Christian M Loris. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.