473,748 Members | 4,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mainframe Datatype Scrubbing

I have a million record mainframe flat file that I BULK INSERT into a
SQL table with CHAR(fieldlengt h) deined for every column to prevent
import errors.

Once imported I "INSERT INTO ... SELECT
dbo.MyScrubFunc tion(columnN),. .."
My scrub functions will take for example a char(8) YYYYMMDD date field
and return either a valid datetime variable or a NULL for 8-spaces or
8-zeros....or return a MONEY datatype by dividing by 100.

PROBLEM: This is extremely SLOW!
QUESTION: Should I do multiple "UPDATE ...SET" statements back into
CHAR() columns, then let SQL Server do the CHAR() to DATETIME and
MONEY conversions itself? What is the most efficient or recommended
method to transform/scrub imported data?

P.S. I also have to convert low-values and reformat dates which I
also use my own UDFs for.

THANKS
Jul 20 '05 #1
1 2557
Steve (st*******@cogn izantdesign.com ) writes:
I have a million record mainframe flat file that I BULK INSERT into a
SQL table with CHAR(fieldlengt h) deined for every column to prevent
import errors.

Once imported I "INSERT INTO ... SELECT
dbo.MyScrubFunc tion(columnN),. .."
My scrub functions will take for example a char(8) YYYYMMDD date field
and return either a valid datetime variable or a NULL for 8-spaces or
8-zeros....or return a MONEY datatype by dividing by 100.

PROBLEM: This is extremely SLOW!
QUESTION: Should I do multiple "UPDATE ...SET" statements back into
CHAR() columns, then let SQL Server do the CHAR() to DATETIME and
MONEY conversions itself? What is the most efficient or recommended
method to transform/scrub imported data?


The problem with scalar UDFs is that behind the scenes they convert a
fine set-based query to something which is very close to a cursor. Thus
expanding the scrub function to be in-place in the query could have an
enourmous impact. But that may not be possible.

One idea could be to break it up in pieces. First find out which rows
that are fine, and insert these on the spot. If that is 80% of the
data, then you could do the real scrubbing on the last 20%.

The problem with just saying convert() is that SQL Server will bomb
out if any value does not convert.
--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
18859
by: Erik-Jan Bakker | last post by:
Hi I am not a javascript expert and I have a problem that the guru's in this newsgroup probably can solve quickly. ;-) I've made a webpage with three frames: top, left and mainframe. I defined this in a frameset called index.htm. Each frame is loaded with a specific page: top:title.htm, left:menu.htm and mainframe:start.htm. So far so good...
4
5038
by: karpagam | last post by:
Since WebServices are a standardized way to invoke a method of another application over the internet, is there a way to integrate two different applications running on different platforms (Say a .NET client application, used for implementing the presentation logic, and a mainframe application that contains the business logic). Is there a way to call the .NET web service from the mainframe application / expose the buiness logic in the...
1
2256
by: uli2003wien | last post by:
Dear group, i am a seasoned DB2-veteran (6 years exp.) on the Windows- and Linux-Server platform. Once in a while i had a look into DB2 on the mainframe but mostly only watching other people do the job. Currently i have an offer to go into a very big shop which runs DB2 on the mainframe (OS is not yet specified, but they talk about VSAM, so it will be no UNIX on mainframe). From my knowledge DB2 on Linux or Windows is a different...
1
2181
by: Thureen | last post by:
I just started using the mainframe (z/OS) 2 days ago, so I am very inexperienced in it. However, I need to write c++ programs for mainframe. Right now, the other mainframe programmers have showed me a complicated (seemed very complicated and painful to me) on how to compile, link, and execute using JCL (job control language) on the mainframe. However, I don't know JCL and those JCL files are quite confusing to figure how to edit them for...
3
5394
by: dinoo | last post by:
Hi, I need help here. I am converting an vb application to c#. The existing application connects to the mainframe server using FTP and downloads a file (dataset). Is it possible in .NET to avoid FTP and use any providers to connect to the mainframe server and download a file. I would appreciate if someone can give a reference to a link or code.
1
1645
by: Gil Lapid | last post by:
Hi, What is the recommended way to develop DB2 Mainframe application without buying this expensive hardware/software ? I'd like to develop the software for a Mainframe customer. Thanks, Gil
6
2698
by: R. Vince | last post by:
I'm been roped into a techical discussion next week as to whether our Java applet / php site can run on a "mainframe." (I know not what kind of "mainframe" or OS). Is this kind of thing even in the realm of possibility? Or should i tell them to rewrite the whole thing in COBOL? Thanks
10
1968
by: Sanders Kaufman | last post by:
I have a function that passes a csv string to mysql to use as values: <?php function fnINSERT ($csvValues) { $sSQL = "INSERT INTO mytable ( field_a, field_b, field_b, field_c ) VALUES { $csvValues); return mysql_query($sSQL); }
11
1889
by: BD | last post by:
Hi, all. I'm running 8.2 on Windows. This is a development platform for a project whose production environment is running on a mainframe. I believe that the RI compilation process is not quite as robust on Windows as it is in other environments. Here's what I'm finding:
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.