![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
Could you elaborate? Reset with what? I am not sure what you are trying to do. "RayAll" <RayAll (AT) microsft (DOT) com> wrote 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 |
#4
| |||
| |||
|
|
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 "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:eu9EuJVIFHA.3696 (AT) tk2msftngp13 (DOT) phx.gbl... Could you elaborate? Reset with what? I am not sure what you are trying to do. "RayAll" <RayAll (AT) microsft (DOT) com> wrote 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 |
#5
| |||
| |||
|
|
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 "ALI-R" <Ray (AT) Alirezaei (DOT) com> wrote 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 "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:eu9EuJVIFHA.3696 (AT) tk2msftngp13 (DOT) phx.gbl... Could you elaborate? Reset with what? I am not sure what you are trying to do. "RayAll" <RayAll (AT) microsft (DOT) com> wrote in message news:RayAll (AT) microsft (DOT) com: 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 |
#6
| |||
| |||
|
|
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 "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OFo$AYWIFHA.1948 (AT) TK2MSFTNGP14 (DOT) phx.gbl... 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 "ALI-R" <Ray (AT) Alirezaei (DOT) com> wrote 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 "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:eu9EuJVIFHA.3696 (AT) tk2msftngp13 (DOT) phx.gbl... Could you elaborate? Reset with what? I am not sure what you are trying to do. "RayAll" <RayAll (AT) microsft (DOT) com> wrote in message news:RayAll (AT) microsft (DOT) com: 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 |
#7
| |||
| |||
|
|
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 "RayAll" <RayAll (AT) microsft (DOT) com> wrote 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 "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:OFo$AYWIFHA.1948 (AT) TK2MSFTNGP14 (DOT) phx.gbl... 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 "ALI-R" <Ray (AT) Alirezaei (DOT) com> wrote 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 "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:eu9EuJVIFHA.3696 (AT) tk2msftngp13 (DOT) phx.gbl... Could you elaborate? Reset with what? I am not sure what you are trying to do. "RayAll" <RayAll (AT) microsft (DOT) com> wrote in message news:RayAll (AT) microsft (DOT) com: 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 |
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
|
I really think you should take this outside of dts. Normally when people handles things like this from my experience and need to validate data, they write some code, depending on your programming language of choice, to read through the file, record by record, do the validation, and then save the result to 1 or more other files, but probably just one in your case. That way, you're not trying to do too complicated of things inside dts, you have full control over what happens when you encounter a problem, and you can clean everything up to just let dts get your data in the database fast, which in my opinion is really what it's ideal for. |
![]() |
| Thread Tools | |
| Display Modes | |
| |