September 10, 2014 at 8:33 am
Hi
I have date field stored as 2014-08-03 on the Table, and I'm trying to select convert(varchar(10), LAST_MOD_DT, 103) AS LAST_MOD_DT
from TBL_MEMBER_GROUP
But I keep on getting the same format; 2014-08-03.
help
September 10, 2014 at 8:48 am
Convert your date to datetime data type first - CAST(LAST_MOD_DT AS Date)
Use this link for knowledge reference: http://sqlmag.com/sql-server/solving-datetime-mystery
**ASCII stupid question, get a stupid ANSI !!!**
September 10, 2014 at 9:22 am
This is yet another reason, in the extremely long list, of why you should use the proper datatypes. Since you are storing datetime data as character data you don't have a datetime to work with.
_______________________________________________________________
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/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply