Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tyekhan786
Starting Member
9 Posts |
Posted - 2014-03-29 : 10:52:33
|
I need to change the Datetime field to Data only.Current format -- 28/09/2013 12:59:20Format wanted --- 2013-09-28Date only in YYYY-MM-DDThanks |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2014-03-31 : 13:26:40
|
SELECT CONVERT(varchar(8), datetime_column, 120) AS date_only |
|
|
sqlsaga
Yak Posting Veteran
93 Posts |
Posted - 2014-03-31 : 15:38:24
|
Input you passed is not in the date time format...DECLARE @Input DATETIME= '2013/09/28 12:59:20'SELECT CONVERT(DATE, @Input)SELECT CONVERT(VARCHAR(10), @Input, 120)Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles. |
|
|
|
|
|