SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


convert datatype DT_STRING to DT_DBDATE in ssis


convert datatype DT_STRING to DT_DBDATE in ssis

Author
Message
peterk1961
peterk1961
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 Visits: 46
I guess, I didn't read your initial post correctly. If you want null when the date value is '0' use NULL(DT_DBDATE).
Peter
NINAD-411800
NINAD-411800
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 24
Hi,
Since the expression is cast to DB_TIMESTAMP, would it not fail for invalid date string?
eg. If the input string is 20090230 (which is an invalid date), how do you handle this in the expression.
peterk1961
peterk1961
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 Visits: 46
This example shows how to check for valid date and replace default date for invalid date.
(DT_BOOL)(DT_DATE)IssueDate_C ? IssueDate_C : "01/01/1900"
niladri_chatterjee
niladri_chatterjee
Grasshopper
Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)Grasshopper (22 reputation)

Group: General Forum Members
Points: 22 Visits: 17
SELECT CONVERT(VARCHAR(10),GETDATE(),121);
Output: 2013-06-12

Example:-
SELECT CONVERT(VARCHAR(10),ContractEndDate,121)
From TestDataTable_Archive;


You can Play with the different format values like 111 etc.

SELECT CONVERT(VARCHAR(10),GETDATE(),111);
Output: 2013/09/30
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search