Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Transform Task Select Based On a Column Value? 1

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
hi experts,

This is 2000.

I'm importing a text .txt file into a table.

Very simple but I want to check the value of the text file's first column - if it begins with '9', import it else exclude it.

Can this be done when the connection is table/view, not SQL query?

Thanks, John
 
I have never done this, but perhaps you could try something like this:

Code:
Function Main()
	
If Left(DTSSource("MyCol"), 1) = "9" then
     DTSDestination("MyCol") = DTSSource("MyCol")
     DTSDestination("MyCol2") = DTSSource("MyCol2")
     'etc...

End If

Main = DTSTransformStat_OK

End Function

I think this will move your rows across ONLY if the condition is met.

If I need something like this done, I bring it into a staging area first so that I can use a SQL Query to filter what I want to move into final table, but this might work.

Let me know how it turns out.

Alex

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top