473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Mainframe Datatype Scrubbing

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

Once imported I "INSERT INTO ... SELECT
dbo.MyScrubFunction(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 2534
Steve (st*******@cognizantdesign.com) writes:
I have a million record mainframe flat file that I BULK INSERT into a
SQL table with CHAR(fieldlength) deined for every column to prevent
import errors.

Once imported I "INSERT INTO ... SELECT
dbo.MyScrubFunction(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
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...
4
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...
1
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...
1
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...
3
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...
1
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, ...
6
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...
10
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 {...
11
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.