Groups | Blog | Home
all groups > sql server dts > march 2005 >

sql server dts : global variable needs to be set on each row


RayAll
3/4/2005 3:05:17 PM
Hi All,

I'd like to have a global variable which is reset on every row in my data
pump task.I tried to reset my global variable in the first first field of my
column mapping in Data pump task ,but to my surprise there is no order for
columns to be transfered in each record.

Any suggessions?

Thanks

ALI-R
3/5/2005 12:43:04 AM
I have four field in each row:

Field1 Field2 Field3 Field4

I'd like to set my global variable to 1 in Filed1 and if in the other fields
a validation error ocuured I set it to 0 and in the rest because it's 0 I
don't check the validation,but this mechanism should be reset in every row.I
tried it but Data pump task (which I'm using to pump data from a CSV file
into a Table) ,transforms fields in each row ,with no special order (I
thought fields are transformed from let to right) that's why I came up with
this idea.

Makes sence?

Thanks for your help

[quoted text, click to view]

Allan Mitchell
3/5/2005 7:15:18 AM
Could you elaborate?

Reset with what?

I am not sure what you are trying to do.


[quoted text, click to view]
Allan Mitchell
3/5/2005 9:35:24 AM
What type of validation errors?

You don't need a GV at all as far as I can see

Say I want to see if Col2 on the Source == 2 and if it is I set
Destination Col3 to 1 and if not I set it to 0


DTSDestination("Col2") = DTSSource("Col2")

If DTSSource("Col2") = 2 THEN
DTSDestination("Col1") = 1
ELSE
DTSDestination("Col1") = 0
END IF


If the Source is SQL Server then you do not even need to do it here at
all you can do it in the SourceSQLStatement

SELECT
Col2,
CASE WHEN Col2 = 2 THEN 1 ELSE 0 END as Validation
FROM
TABLE

Make sense?

Allan


[quoted text, click to view]
RayAll
3/5/2005 12:39:42 PM
Yes ,you are right ,but I don't want other fields in the same row overwrite
the column I have associated with having error status per row.

I'd like to write to that field(error status) only once ,because I'm
inserting each field's validation error to a seperate table and I want this
field only shows that wether there is an error happened in this row or not
,for details I would use the other table.there might be 10 errors per row
,but I want to update this field only once.

Dose that make sence?do you have any better suggessions?

Thanks for your help
[quoted text, click to view]

Allan Mitchell
3/6/2005 9:33:12 AM
This validation will occur on each Row*Row. You may want to experiment
with doing this up front of the DataPump task. All your valid Qs
recently have been based around the Lookup. Remember this operates on
EVERY row so IMHO does not scale well on large datasets particularly


Allan

[quoted text, click to view]
RayAll
3/6/2005 12:05:46 PM
Allan,

I have 33 fields in each record and I have to validate each field anyways
and log every single validation error in a seperate table(**NO DOUBT ABOUT
IT**).in my senario the only thing which is added is to check if the
status_code is not set before and if not set it to 1(which mean critical
error).I'd like to use this field for further processing because output of
this step would be input to another DTS package which dose the business
rules on the records which are ok (I mean there is no validation error
occured on them).I know there might be performance issue regarding this
scenario.But this proecess is supposed to be launched at midnigh and for
client what is important is not the performance of the system ,but the
ability to tell them what was wrong (in very detail) with their CSV file

Thanks and sorry for asking lots of questions.Now I have a very bright
underesanding of what I m going to accomplish.

I so appreciate your help.

Ray
[quoted text, click to view]

AddThis Social Bookmark Button