December 21, 2009 at 9:37 am
I have to add a column LAST_UPDT_DT_KEY_NO (whose datatype is NUMBER(10,0) in target) and i have to assign today's date to that column.
So in Derived Columns i wrote LAST_UPDT_DT_KEY_NO as Derived column's name and in derived column i kept as "add as a new column" and in expression i wrote DATEPART("year",GETDATE()) and datatype is automatically taken as four-byte signed integer and i am unable to wite anything in precision and scale.
As i said in target table datatype is as NUMBER (10,0) i want to convert it to number. How can i do that?
December 21, 2009 at 12:49 pm
rahulsony111 (12/21/2009)
I have to add a column LAST_UPDT_DT_KEY_NO (whose datatype is NUMBER(10,0) in target) and i have to assign today's date to that column.So in Derived Columns i wrote LAST_UPDT_DT_KEY_NO as Derived column's name and in derived column i kept as "add as a new column" and in expression i wrote DATEPART("year",GETDATE()) and datatype is automatically taken as four-byte signed integer and i am unable to wite anything in precision and scale.
As i said in target table datatype is as NUMBER (10,0) i want to convert it to number. How can i do that?
Cast it to a numeric(10,0) in your derived column as follows:
(DT_NUMERIC 10,0)DATEPART("year",GETDATE())
Josef Richberg
2009 Exceptional DBA
http://www.josef-richberg.squarespace.com
http://twitter.com/sqlrunner
December 21, 2009 at 2:52 pm
sqlrunner is correct, you must cast it within the expression.
Just a question though, why would you not store using the date data type?
December 21, 2009 at 2:56 pm
Nevermind, I just saw the other threads for this question.
Let's end this thread and continue all responses to this thread:
http://www.sqlservercentral.com/Forums/Topic837454-148-1.aspx
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply