October 24, 2008 at 7:51 am
I have a SQL Server 2000 data table with 1 field that contains an XML string. I am currently using an ETL tool to pass an XML string into a stored procedure for each record in my table (~100K records), which is causing some inefficiencies with going across platforms (Unix/Windows). I would like to find a way to go through my entire dataset in a self-contained procedure, but the issue I am facing is that I cannot create an NTEXT local variable to hold my XML string as I go through a SQL Server cursor. My XML is too big to fit into a varchar/nvarchar datatype, and I haven't been able to come across a way to pass the XML into the proc (which is set to receive NTEXT).
Is anyone aware of any way that I can utilize some form of "temporary" storage (cursor, temp table, etc.) to get through my process in a single stored proc?
October 29, 2008 at 10:30 am
Upgrade to SQL Server 2005.
Then you will have the XML data type which gives you up to 2 gigs in a single XML instance. If you need more then this then your doing something wrong and need to go back to the white board.
October 29, 2008 at 10:40 am
I'll second the "upgrade to 2005" opinion. That being said, once you DO, consider changing the behavior to take in a SINGLE "large" XML with all of the records in it (and not cursor through anything). Bulk-load that using the tools at hand, index it etc..., if need be accessing an external file with the XML in it.
Single threading through this in the way you're envisioning is just putting an unnecessary throttle on an aspect that has seen a lot of perf improvements in the last 2 versions (2005 and 2008 that is).
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
October 29, 2008 at 10:49 am
I appreciate your feedback, but it's not that simple. We have a third-party application that does not support 2005. I understand this isn't the ideal situation, but sometimes you have to deal with the hand you're given. 😉
October 29, 2008 at 11:23 am
Then I'd flip the issue around. Use a .NET console app to create a properly delimited file (not XML) from the "native" XML, and the bulk load the new file. That way - the bulk load gets a "clean file" and can concentrate on importing the stuff as fast as it can. In my experience - that's been the fastest way to load stuff like what you're describing.
Keep in mind that you could also use SSIS as the processing vehicle, which can then end up pointing to a SQL 2000 destination (once everything is all done etc...) Of course - this involves having 2 SQL Servers (one to process the file in which would be SQL 2005, and one with the 3rd party app which remains in 2000)
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
October 29, 2008 at 11:36 am
Wonderful...I'll have to look into the possibility of putting the data in a delimited format. I'm not sure exactly how I can go about doing that, but I have a path to explore.
Thanks!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply