Making a year column by semester
hi! I have a column semester like Fall94,Spring94,Fall95,Spring95,.........,Fall00,Spring00,Fall01,Spring01,Fall02,Spring02,.......Fall05,Spring05 & so on i want to make a new column of 'year' means if FINDSTRING([SEMESTER], "94",1) ==1 ,then year is 1994 & so onmhassanshahbaz
December 12th, 2010 1:20am

try this: ((DT_I4)RIGHT([Semester],2)<50) ? (DT_I4)("20"+RIGHT([Semester],2)) : (DT_I4)("19"+RIGHT([Semester],2))http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2010 1:27am

hi! ok i`m trying it,as the same time I`m trying to make Grade column like we made GPAEQUIVALENT,but error occurs "(DT_STR,10,1252)([Marks] < 50 ? "F" : [Marks] )" TITLE: Microsoft Visual Studio ------------------------------ Error at Student_History_Fact [GPAEquivalentMarks [342]]: The data types "DT_WSTR" and "DT_I4" are incompatible for the conditional operator. The operand types cannot be implicitly cast into compatible types for the conditional operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator. Error at Student_History_Fact [GPAEquivalentMarks [342]]: Attempt to set the result type of conditional operation "Marks < 50 ? "F" : Marks" failed with error code 0xC004709F. Error at Student_History_Fact [GPAEquivalentMarks [342]]: Computing the expression "(DT_STR,10,1252)([Marks] < 50 ? "F" : [Marks] )" failed with error code 0xC00470A0. The expression may have errors, such as divide by zero, that cannot be detected at parse time, or there may be an out-of-memory error. Error at Student_History_Fact [GPAEquivalentMarks [342]]: The expression "(DT_STR,10,1252)([Marks] < 50 ? "F" : [Marks] )" on "output column "Grede" (995)" is not valid. Error at Student_History_Fact [GPAEquivalentMarks [342]]: Failed to set property "Expression" on "output column "Grede" (995)". ------------------------------ ADDITIONAL INFORMATION: Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap) ------------------------------ BUTTONS: OK ------------------------------ mhassanshahbaz
December 12th, 2010 1:38am

I don't understand what is relation between your two questions, but first let me know what is data type of Marks ?http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2010 1:49am

thank you Reza!! for marks it`s DT_I4 actually i was working on grade and year,when i did not fix it i asked youmhassanshahbaz
December 12th, 2010 1:54am

for the second expression, try this one: [Marks] < 50 ? "F" : ((DT_STR,10,1252)[Marks])http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2010 1:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics