August 4, 2011 at 9:48 am
Hello
In derived column,
I have Date column named (AS_DATE)
and i used
(DT_DBDATE)(GETDATE) in derived column.
OUTPUT IS IN SQL SERVER.
2011-08-04 00:00:00.000
I have sql server 2005 so datatype for as_date is datetime.
But I want a output
2011-08-04
I do not want time in my sql database.
any one can tell me how to change derived column to get only date ?
Thanks
L
August 4, 2011 at 10:13 am
Being that you have sql 2005 there is no such datatype as date. As you said you have to use datetime. You can display your datetime field in any format when you pull your data back out. Checkout convert on bol. There are a zillion ways you can format your datetime field to show what you want.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 4, 2011 at 11:09 am
Thanks for replying me.:-)
Please can you explain me detail , How can i do with SSIS?
Thanks
L
August 4, 2011 at 12:25 pm
That is the point. You can't exclude the timestamp from a datetime datatype. You will have to use Convert to get the display in the format you want from whatever is going to display the data. If you can upgrade to 2008 then you have a date datatype which will do pretty much what you are looking for.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 5, 2011 at 1:09 am
You can use SELECT CONVERT(char(10),GETDATE(), 120), as Sean suggested.
Hope this helps
Gianluca
-- Gianluca Sartori
March 2, 2014 at 8:29 am
In the EXPRESSION field of your Derived Column Transformation Editor, use this: (DT_DBDATE)GETDATE()
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply