Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-11-03 : 15:53:45
|
Hi AllI m designing SSIS having Data Flow as Flat File > Derived Column Transformation > Destination Tablebut while transfering record from text file to table i need some logic heremy text file is "ID"|"Name"1012|"10AA"1013|"10BB"logic is 10 should be replace by variable VID = 98I defined this veriable as intMy ID column in database is int and Name column is varchar(50)I try here expression likeID != 98 ? @[User::VID] : IDit work finebut for varchar column I am not able to doI got error when i write expressionSUBSTRING(Name,1,2) != "98" ? [DT_STR, 50, 1252] "(@[User::VID])" + rest of value of column : [Name] my final output in table should be likeID..Name98..98AA98..98BBPlease help me outT.I.A |
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-11-03 : 16:15:44
|
HI allI tried thisSUBSTRING(Name,1,2) != "98" ? (DT_STR,50,1252)(@[User::VID]) + RIGHT(Name,LEN(ChID) - 2) : [Name]it worked fine :)Thanks any way |
 |
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-11-12 : 03:51:13
|
Hi,I need help for importing my text file into DB tableIf my text file contain NULL value for numeric data type then I am getting errormy expression for derived column is ISNULL(ID) ? NULL(DT_Numeric,18,0) : ((SUBSTRING((DT_STR,18,1252)ID,1,3) != "101" && SUBSTRING((DT_STR,18,1252)ID,1,2) != "98") ? (DT_Numeric,18,0)((DT_STR,3,1252)(@[User::tID]) + RIGHT((DT_STR,18,1252)ID,LEN((DT_STR,18,1252)ID) - 3)) : ID)datatype for ID is numericI need to rplace my text "ID" column if there is value other than 101 or 98 (eg. 1012356 replace and get value as @[User::tID] + 2356)whats wrong with expression syntaxPlease help me outT.I.A |
 |
|
|
|
|
|
|